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


PHP dbq函数代码示例

本文整理汇总了PHP中dbq函数的典型用法代码示例。如果您正苦于以下问题:PHP dbq函数的具体用法?PHP dbq怎么用?PHP dbq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: ilist

 public function ilist($parent_id = NULL)
 {
     $where = '';
     if (!is_null($parent_id)) {
         $where .= 'and parent_id=' . dbq($parent_id);
     }
     return db_array("select * from " . $this->table_name . " where status=0 {$where} order by parent_id, prio desc, iname");
 }
开发者ID:osalabs,项目名称:osafw-php,代码行数:8,代码来源:Categories.php

示例2: add_thread

function add_thread($itemid, $onlyshadow = false)
{
    $items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`,\n\t\t\t`deleted`, `origin`, `forum_mode`, `mention`, `network`  FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
    if (!$items) {
        return;
    }
    $item = $items[0];
    $item['iid'] = $itemid;
    if (!$onlyshadow) {
        $result = dbq("INSERT INTO `thread` (`" . implode("`, `", array_keys($item)) . "`) VALUES ('" . implode("', '", array_values($item)) . "')");
        logger("add_thread: Add thread for item " . $itemid . " - " . print_r($result, true), LOGGER_DEBUG);
    }
    // is it already a copy?
    if ($itemid == 0 or $item['uid'] == 0) {
        return;
    }
    // Is it a visible public post?
    if (!$item["visible"] or $item["deleted"] or $item["moderated"] or $item["private"]) {
        return;
    }
    // is it an entry from a connector? Only add an entry for natively connected networks
    if (!in_array($item["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""))) {
        return;
    }
    // Only do these checks if the post isn't a wall post
    if (!$item["wall"]) {
        // Check, if hide-friends is activated - then don't do a shadow entry
        $r = q("SELECT `hide-friends` FROM `profile` WHERE `is-default` AND `uid` = %d AND NOT `hide-friends`", $item['uid']);
        if (!count($r)) {
            return;
        }
        // Check if the contact is hidden or blocked
        $r = q("SELECT `id` FROM `contact` WHERE NOT `hidden` AND NOT `blocked` AND `id` = %d", $item['contact-id']);
        if (!count($r)) {
            return;
        }
    }
    // Only add a shadow, if the profile isn't hidden
    $r = q("SELECT `uid` FROM `user` where `uid` = %d AND NOT `hidewall`", $item['uid']);
    if (!count($r)) {
        return;
    }
    $item = q("SELECT * FROM `item` WHERE `id` = %d", intval($itemid));
    if (count($item) and $item[0]["allow_cid"] == '' and $item[0]["allow_gid"] == '' and $item[0]["deny_cid"] == '' and $item[0]["deny_gid"] == '') {
        $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = 0 LIMIT 1", dbesc($item['uri']));
        if (!$r) {
            // Preparing public shadow (removing user specific data)
            require_once "include/items.php";
            require_once "include/Contact.php";
            unset($item[0]['id']);
            $item[0]['uid'] = 0;
            $item[0]['contact-id'] = get_contact($item[0]['author-link'], 0);
            $public_shadow = item_store($item[0], false, false, true);
            logger("add_thread: Stored public shadow for post " . $itemid . " under id " . $public_shadow, LOGGER_DEBUG);
        }
    }
}
开发者ID:vinzv,项目名称:friendica,代码行数:57,代码来源:threads.php

示例3: makeStructure

function makeStructure($parent, $prefix, $sort)
{
    global $user, $id, $path, $cfg, $lang;
    $db = dbq("SELECT id, title, type, online, sort FROM {$cfg['db']['prefix']}_structure WHERE parent = {$parent} AND viewRights LIKE '%({$user['parent']})%' ORDER BY {$sort}");
    if (is_array($db)) {
        for ($i = 0; $i < count($db); $i++) {
            echo '<tr><td><table><tr>';
            echo $prefix;
            if (isset($db[$i + 1])) {
                echo '<td class="thread trb">&nbsp;&nbsp;</td>';
            } else {
                echo '<td class="thread tr">&nbsp;&nbsp;</td>';
            }
            if (in_array(array($db[$i]['id'], $db[$i]['title']), $path) && dbq("SELECT * FROM {$cfg['db']['prefix']}_structure WHERE parent = {$db[$i]['id']}")) {
                echo '<td class="thread bl">';
            } else {
                echo '<td class="thread l">';
            }
            if (file_exists('img/ico-rec/' . $db[$i]['type'] . '.gif')) {
                echo '<img src="img/ico-rec/' . $db[$i]['type'] . '.gif" alt="' . ucfirst($db[$i]['type']) . '" /></td><td>';
            } else {
                echo '<img src="img/ico-rec/folder.gif" alt="' . ucfirst($db[$i]['type']) . '" /></td><td>';
            }
            if ($db[$i]['id'] == $id) {
                echo '<strong>';
            }
            if ($db[$i]['online'] == 0) {
                echo '<em>';
            }
            if ($user['parent'] == '970') {
                $sql = "SELECT * FROM user WHERE email = '" . $_SESSION['epUser']['title'] . "'";
                $test = dbq($sql);
                echo '<a href=".?id=' . $db[$i]['id'] . '&aid=' . $test[0]['id'] . '">' . htmlspecialchars($db[$i]['title']) . '</a>';
            } else {
                if ($db[$i]['title'] != '') {
                    echo '<a href=".?id=' . $db[$i]['id'] . '">' . htmlspecialchars($db[$i]['title']) . '</a>';
                } else {
                    echo '<a href=".?id=' . $db[$i]['id'] . '">' . $lang[5] . '</a>';
                }
            }
            if ($db[$i]['online'] == 0) {
                echo '</em>';
            }
            if ($db[$i]['id'] == $id) {
                echo '</strong>';
            }
            echo '</td></tr></table></td></tr>';
            if (in_array(array($db[$i]['id'], $db[$i]['title']), $path) && dbq("SELECT * FROM {$cfg['db']['prefix']}_structure WHERE parent = {$db[$i]['id']}")) {
                if (isset($db[$i + 1])) {
                    makeStructure($db[$i]['id'], $prefix . '<td class="thread tb">&nbsp;&nbsp;</td>', $db[$i]['sort']);
                } else {
                    makeStructure($db[$i]['id'], $prefix . '<td class="thread">&nbsp;&nbsp;</td>', $db[$i]['sort']);
                }
            }
        }
    }
}
开发者ID:nukem,项目名称:WorkSound,代码行数:57,代码来源:structure.php

示例4: add_thread

function add_thread($itemid)
{
    $items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`,\n\t\t\t`deleted`, `origin`, `forum_mode`, `mention`, `network`  FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
    if (!$items) {
        return;
    }
    $item = $items[0];
    $item['iid'] = $itemid;
    $result = dbq("INSERT INTO `thread` (`" . implode("`, `", array_keys($item)) . "`) VALUES ('" . implode("', '", array_values($item)) . "')");
    logger("add_thread: Add thread for item " . $itemid . " - " . print_r($result, true), LOGGER_DEBUG);
}
开发者ID:jzacman,项目名称:friendica,代码行数:11,代码来源:threads.php

示例5: IndexAction

 public function IndexAction()
 {
     #get filters from the search form
     $f = $this->get_filter();
     $this->set_list_sorting();
     $this->list_where = ' 1=1 ';
     $this->set_list_search();
     //other filters add to $this->list_where here
     //if search - no category
     if ($f['s'] == '') {
         $this->list_where .= ' and icat=' . dbq($f['icat']);
     }
     $this->get_list_rows();
     //add/modify rows from db
     /*
     foreach ($this->list_rows as $k => $row) {
         $this->list_rows[$k]['field'] = 'value';
     }
     */
     $ps = array('list_rows' => $this->list_rows, 'count' => $this->list_count, 'pager' => $this->list_pager, 'f' => $this->list_filter);
     return $ps;
 }
开发者ID:ozkangol,项目名称:osafw-php,代码行数:22,代码来源:AdminSettings.php

示例6: save_np_categories

function save_np_categories($userid = 0, $subscribe = 0, $categories = array())
{
    if ($subscribe == false) {
        $sql = 'DELETE FROM np_customer_category WHERE custid_fk = ' . $userid;
        dbq($sql);
        $return['success'] = true;
        $return['message'] = 'User removed from Newsletter Pro';
    } else {
        if (count($categories) <= 0) {
            $return['success'] = false;
            $return['message'] = 'Unable to save user. At least one category is required.';
        } else {
            $sql = 'DELETE FROM np_customer_category WHERE custid_fk = ' . $userid;
            dbq($sql);
            foreach ($categories as $cat) {
                $sql = 'INSERT INTO np_customer_category (custid_fk, categoryid_fk) VALUES (' . $userid . ', ' . $cat . ');';
                dbq($sql);
            }
            $return['success'] = true;
            $return['message'] = 'Newsletter Pro categories have been saved.';
        }
    }
    return $return;
}
开发者ID:nukem,项目名称:Twist,代码行数:24,代码来源:fn.php

示例7: local_delivery


//.........这里部分代码省略.........
            $r = q("INSERT INTO `fcontact` ( `name`,`url`,`photo`,`request` ) VALUES ( '%s', '%s', '%s', '%s' ) ", dbesc($fsugg['name']), dbesc($fsugg['url']), dbesc($fsugg['photo']), dbesc($fsugg['request']));
        }
        $r = q("SELECT * FROM `fcontact` WHERE `url` = '%s' AND `name` = '%s' AND `request` = '%s' LIMIT 1", dbesc($fsugg['url']), dbesc($fsugg['name']), dbesc($fsugg['request']));
        if (count($r)) {
            $fid = $r[0]['id'];
        } else {
            return 0;
        }
        $hash = random_string();
        $r = q("INSERT INTO `intro` ( `uid`, `fid`, `contact-id`, `note`, `hash`, `datetime`, `blocked` )\n\t\t\tVALUES( %d, %d, %d, '%s', '%s', '%s', %d )", intval($fsugg['uid']), intval($fid), intval($fsugg['cid']), dbesc($fsugg['body']), dbesc($hash), dbesc(datetime_convert()), intval(0));
        notification(array('type' => NOTIFY_SUGGEST, 'notify_flags' => $importer['notify-flags'], 'language' => $importer['language'], 'to_name' => $importer['username'], 'to_email' => $importer['email'], 'uid' => $importer['importer_uid'], 'item' => $fsugg, 'link' => $a->get_baseurl() . '/notifications/intros', 'source_name' => $importer['name'], 'source_link' => $importer['url'], 'source_photo' => $importer['photo'], 'verb' => ACTIVITY_REQ_FRIEND, 'otype' => 'intro'));
        return 0;
    }
    $ismail = false;
    $rawmail = $feed->get_feed_tags(NAMESPACE_DFRN, 'mail');
    if (isset($rawmail[0]['child'][NAMESPACE_DFRN])) {
        logger('local_delivery: private message received');
        $ismail = true;
        $base = $rawmail[0]['child'][NAMESPACE_DFRN];
        $msg = array();
        $msg['uid'] = $importer['importer_uid'];
        $msg['from-name'] = notags(unxmlify($base['sender'][0]['child'][NAMESPACE_DFRN]['name'][0]['data']));
        $msg['from-photo'] = notags(unxmlify($base['sender'][0]['child'][NAMESPACE_DFRN]['avatar'][0]['data']));
        $msg['from-url'] = notags(unxmlify($base['sender'][0]['child'][NAMESPACE_DFRN]['uri'][0]['data']));
        $msg['contact-id'] = $importer['id'];
        $msg['title'] = notags(unxmlify($base['subject'][0]['data']));
        $msg['body'] = escape_tags(unxmlify($base['content'][0]['data']));
        $msg['seen'] = 0;
        $msg['replied'] = 0;
        $msg['uri'] = notags(unxmlify($base['id'][0]['data']));
        $msg['parent-uri'] = notags(unxmlify($base['in-reply-to'][0]['data']));
        $msg['created'] = datetime_convert(notags(unxmlify('UTC', 'UTC', $base['sentdate'][0]['data'])));
        dbesc_array($msg);
        $r = dbq("INSERT INTO `mail` (`" . implode("`, `", array_keys($msg)) . "`) VALUES ('" . implode("', '", array_values($msg)) . "')");
        // send notifications.
        require_once 'include/enotify.php';
        $notif_params = array('type' => NOTIFY_MAIL, 'notify_flags' => $importer['notify-flags'], 'language' => $importer['language'], 'to_name' => $importer['username'], 'to_email' => $importer['email'], 'uid' => $importer['importer_uid'], 'item' => $msg, 'source_name' => $msg['from-name'], 'source_link' => $importer['url'], 'source_photo' => $importer['thumb'], 'verb' => ACTIVITY_POST, 'otype' => 'mail');
        notification($notif_params);
        return 0;
        // NOTREACHED
    }
    $community_page = 0;
    $rawtags = $feed->get_feed_tags(NAMESPACE_DFRN, 'community');
    if ($rawtags) {
        $community_page = intval($rawtags[0]['data']);
    }
    if (intval($importer['forum']) != $community_page) {
        q("update contact set forum = %d where id = %d", intval($community_page), intval($importer['id']));
        $importer['forum'] = (string) $community_page;
    }
    logger('local_delivery: feed item count = ' . $feed->get_item_quantity());
    // process any deleted entries
    $del_entries = $feed->get_feed_tags(NAMESPACE_TOMB, 'deleted-entry');
    if (is_array($del_entries) && count($del_entries)) {
        foreach ($del_entries as $dentry) {
            $deleted = false;
            if (isset($dentry['attribs']['']['ref'])) {
                $uri = $dentry['attribs']['']['ref'];
                $deleted = true;
                if (isset($dentry['attribs']['']['when'])) {
                    $when = $dentry['attribs']['']['when'];
                    $when = datetime_convert('UTC', 'UTC', $when, 'Y-m-d H:i:s');
                } else {
                    $when = datetime_convert('UTC', 'UTC', 'now', 'Y-m-d H:i:s');
                }
            }
开发者ID:EmilienB,项目名称:friendica,代码行数:67,代码来源:items.php

示例8: dbq

<?php

$pricebook_cats = dbq('SELECT * FROM nec_dealer');
?>
<style type="text/css">
			
table#users {
	margin-top: 20px;
	font-size: 11px;
}
#users th {
	text-align: left;
	background: #E1E7EA;
}
#users th.over {
	background: #ccc;
}
#users td, #users th {
	border: 1px solid #CCCCCC;
	border-collapse: collapse;
	padding: 4px 4px;
}
.approvebox {
	text-align: center;
}
.approvebox input {
	margin: 0;
	width: 13px;
	height: 13px;
	overflow: hidden;
}
开发者ID:nukem,项目名称:NEC,代码行数:31,代码来源:usermanagement.php

示例9: do_export_table

function do_export_table($t = '', $isvar = 0, $MAXI = 838860)
{
    global $D;
    @set_time_limit(600);
    if ($_REQUEST['s']) {
        $sth = db_query("show create table `{$t}`");
        $row = mysql_fetch_row($sth);
        $ct = preg_replace("/\n\r|\r\n|\n|\r/", $D, $row[1]);
        ex_w("DROP TABLE IF EXISTS `{$t}`;{$D}{$ct};{$D}{$D}");
    }
    if ($_REQUEST['d']) {
        $exsql = '';
        ex_w("/*!40000 ALTER TABLE `{$t}` DISABLE KEYS */;{$D}");
        $sth = db_query("select * from `{$t}`");
        while ($row = mysql_fetch_row($sth)) {
            $values = '';
            foreach ($row as $v) {
                $values .= ($values ? ',' : '') . dbq($v);
            }
            $exsql .= ($exsql ? ',' : '') . "(" . $values . ")";
            if (strlen($exsql) > $MAXI) {
                ex_w("INSERT INTO `{$t}` VALUES {$exsql};{$D}");
                $exsql = '';
            }
        }
        if ($exsql) {
            ex_w("INSERT INTO `{$t}` VALUES {$exsql};{$D}");
        }
        ex_w("/*!40000 ALTER TABLE `{$t}` ENABLE KEYS */;{$D}{$D}");
    }
    flush();
}
开发者ID:AlvaCorp,项目名称:maxon,代码行数:32,代码来源:phpminiadmin.php

示例10: array_map

    $_POST = array_map('strip_slashes_deep', $_POST);
    $_GET = array_map('strip_slashes_deep', $_GET);
}
if (isset($_GET['type']) && isset($_GET['id']) && preg_match('/^[0-9]+$/', $_GET['id'])) {
    if ($_GET['type'] == 'image') {
        $record = dbq("SELECT parent FROM wp_image_gallery WHERE id = {$_GET['id']}");
        if (!dbq("DELETE FROM `wp_image_gallery` WHERE `id` = '{$_GET['id']}' LIMIT 1")) {
            echo "ERROR";
        } else {
            @unlink($cfg['data'] . "images/" . $_GET['id'] . "-s.jpg");
            @unlink($cfg['data'] . "images/" . $_GET['id'] . "-m.jpg");
            @unlink($cfg['data'] . "images/" . $_GET['id'] . "-l.jpg");
            echo "DELETE SUCCESS";
        }
    } else {
        if ($_GET['type'] == 'file') {
            $record = dbq("SELECT parent FROM wp_file_gallery WHERE id = {$_GET['id']}");
            if (!dbq("DELETE FROM `wp_file_gallery` WHERE `id` = '{$_GET['id']}' LIMIT 1")) {
                echo "ERROR";
            } else {
                $file = glob($cfg['data'] . "files/" . $_GET['id'] . ".*");
                @unlink($file[0]);
                echo "DELETE SUCCESS";
            }
        }
    }
    $parentID = $record[0]['parent'];
    dbq("UPDATE wp_structure SET modified = NOW() WHERE id = {$parentID}");
    dbq("UPDATE wp_file_gallery SET modified = NOW() WHERE parent = {$parentID}");
    dbq("UPDATE wp_image_gallery SET modified = NOW() WHERE parent = {$parentID}");
}
开发者ID:nukem,项目名称:WorkSound,代码行数:31,代码来源:deleteajaxfiles.php

示例11: do_export_table

function do_export_table($t = '', $isvar = 0, $MAXI = 838860)
{
    set_time_limit(600);
    if ($_REQUEST['s']) {
        $sth = db_query("show create table `{$t}`");
        $row = mysql_fetch_row($sth);
        echo "DROP TABLE IF EXISTS `{$t}`;\n{$row['1']};\n\n";
    }
    if ($_REQUEST['d']) {
        $exsql = '';
        echo "/*!40000 ALTER TABLE `{$t}` DISABLE KEYS */;\n";
        $sth = db_query("select * from `{$t}`");
        while ($row = mysql_fetch_row($sth)) {
            $values = '';
            foreach ($row as $value) {
                $values .= ($values ? ',' : '') . "'" . dbq($value) . "'";
            }
            $exsql .= ($exsql ? ',' : '') . "(" . $values . ")";
            if (strlen($exsql) > $MAXI) {
                echo "INSERT INTO `{$t}` VALUES {$exsql};\n";
                $exsql = '';
            }
        }
        if ($exsql) {
            echo "INSERT INTO `{$t}` VALUES {$exsql};\n";
        }
        echo "/*!40000 ALTER TABLE `{$t}` ENABLE KEYS */;\n";
        echo "\n";
    }
    flush();
}
开发者ID:Esdras1995,项目名称:Guardtour,代码行数:31,代码来源:ourdba.php

示例12: process_channel_sync_delivery

/**
 * @brief
 *
 * @param array $sender
 * @param array $arr
 * @param array $deliveries
 * @return array
 */
function process_channel_sync_delivery($sender, $arr, $deliveries)
{
    require_once 'include/import.php';
    /** @FIXME this will sync red structures (channel, pconfig and abook). Eventually we need to make this application agnostic. */
    $result = array();
    foreach ($deliveries as $d) {
        $r = q("select * from channel where channel_hash = '%s' limit 1", dbesc($d['hash']));
        if (!$r) {
            $result[] = array($d['hash'], 'not found');
            continue;
        }
        $channel = $r[0];
        $max_friends = service_class_fetch($channel['channel_id'], 'total_channels');
        $max_feeds = account_service_class_fetch($channel['channel_account_id'], 'total_feeds');
        if ($channel['channel_hash'] != $sender['hash']) {
            logger('process_channel_sync_delivery: possible forgery. Sender ' . $sender['hash'] . ' is not ' . $channel['channel_hash']);
            $result[] = array($d['hash'], 'channel mismatch', $channel['channel_name'], '');
            continue;
        }
        if (array_key_exists('config', $arr) && is_array($arr['config']) && count($arr['config'])) {
            foreach ($arr['config'] as $cat => $k) {
                foreach ($arr['config'][$cat] as $k => $v) {
                    set_pconfig($channel['channel_id'], $cat, $k, $v);
                }
            }
        }
        if (array_key_exists('obj', $arr) && $arr['obj']) {
            sync_objs($channel, $arr['obj']);
        }
        if (array_key_exists('likes', $arr) && $arr['likes']) {
            import_likes($channel, $arr['likes']);
        }
        if (array_key_exists('app', $arr) && $arr['app']) {
            sync_apps($channel, $arr['app']);
        }
        if (array_key_exists('chatroom', $arr) && $arr['chatroom']) {
            sync_chatrooms($channel, $arr['chatroom']);
        }
        if (array_key_exists('conv', $arr) && $arr['conv']) {
            import_conv($channel, $arr['conv']);
        }
        if (array_key_exists('mail', $arr) && $arr['mail']) {
            import_mail($channel, $arr['mail']);
        }
        if (array_key_exists('event', $arr) && $arr['event']) {
            sync_events($channel, $arr['event']);
        }
        if (array_key_exists('event_item', $arr) && $arr['event_item']) {
            sync_items($channel, $arr['event_item']);
        }
        if (array_key_exists('item', $arr) && $arr['item']) {
            sync_items($channel, $arr['item']);
        }
        if (array_key_exists('item_id', $arr) && $arr['item_id']) {
            sync_items($channel, $arr['item_id']);
        }
        if (array_key_exists('menu', $arr) && $arr['menu']) {
            sync_menus($channel, $arr['menu']);
        }
        if (array_key_exists('channel', $arr) && is_array($arr['channel']) && count($arr['channel'])) {
            if (array_key_exists('channel_pageflags', $arr['channel']) && intval($arr['channel']['channel_pageflags'])) {
                // These flags cannot be sync'd.
                // remove the bits from the incoming flags.
                // These correspond to PAGE_REMOVED and PAGE_SYSTEM on redmatrix
                if ($arr['channel']['channel_pageflags'] & 0x8000) {
                    $arr['channel']['channel_pageflags'] = $arr['channel']['channel_pageflags'] - 0x8000;
                }
                if ($arr['channel']['channel_pageflags'] & 0x1000) {
                    $arr['channel']['channel_pageflags'] = $arr['channel']['channel_pageflags'] - 0x1000;
                }
            }
            $disallowed = array('channel_id', 'channel_account_id', 'channel_primary', 'channel_prvkey', 'channel_address', 'channel_notifyflags', 'channel_removed', 'channel_deleted', 'channel_system');
            $clean = array();
            foreach ($arr['channel'] as $k => $v) {
                if (in_array($k, $disallowed)) {
                    continue;
                }
                $clean[$k] = $v;
            }
            if (count($clean)) {
                foreach ($clean as $k => $v) {
                    $r = dbq("UPDATE channel set " . dbesc($k) . " = '" . dbesc($v) . "' where channel_id = " . intval($channel['channel_id']));
                }
            }
        }
        if (array_key_exists('abook', $arr) && is_array($arr['abook']) && count($arr['abook'])) {
            $total_friends = 0;
            $total_feeds = 0;
            $r = q("select abook_id, abook_feed from abook where abook_channel = %d", intval($channel['channel_id']));
            if ($r) {
                // don't count yourself
                $total_friends = count($r) > 0 ? count($r) - 1 : 0;
//.........这里部分代码省略.........
开发者ID:23n,项目名称:hubzilla,代码行数:101,代码来源:zot.php

示例13: dbq

} else {
    ?>
                  <?php 
    echo $lang[68];
    ?>
              <?php 
}
?>
			    </td>
              </tr> 
			  <tr>
			     <td colspan="4">
				    <label>File Can Be Accessed By:</label><br />
					<?php 
$webUsers = dbq("SELECT `id`, `title` FROM {$cfg['db']['prefix']}_folder, {$cfg['db']['prefix']}_structure WHERE link = id AND online = 1 AND parent = 44 ORDER BY position");
$webAccess = dbq("SELECT * FROM {$cfg['db']['prefix']}_access WHERE link = {$id}");
$wac[$id] = array();
if (isset($webAccess) && is_array($webAccess) && count($webAccess) > 0) {
    foreach ($webAccess as $wa) {
        $wac[$id][] = $wa['access'];
    }
}
?>
					<div id="webUsersCategories">
						<?php 
/*if(isset($wuc))
		{
			print_r($wuc);
		}*/
if (isset($webUsers) && is_array($webUsers) && count($webUsers) > 0) {
    foreach ($webUsers as $wuc) {
开发者ID:nukem,项目名称:NEC,代码行数:31,代码来源:document.php

示例14: exit

<?php

require "cfg.php";
require "fn.php";
if (!@mysql_connect($cfg['db']['address'], $cfg['db']['username'], $cfg['db']['password'])) {
    $errors[] = $lang[78];
}
if (!@mysql_select_db($cfg['db']['name'])) {
    $errors[] = $lang[79];
}
$id = $_POST['id'];
if (!is_numeric($id)) {
    exit('no id passed to script');
}
$sql = 'DELETE FROM wp_form_element WHERE id = ' . $id;
dbq($sql);
$json['outcome'] = 'success';
echo json_encode($json);
开发者ID:nukem,项目名称:Twist,代码行数:18,代码来源:form_remove_item.php

示例15: mail_store

function mail_store($arr)
{
    if (!$arr['channel_id']) {
        logger('mail_store: no uid');
        return 0;
    }
    if (strpos($arr['body'], '<') !== false || strpos($arr['body'], '>') !== false) {
        $arr['body'] = escape_tags($arr['body']);
    }
    if (array_key_exists('attach', $arr) && is_array($arr['attach'])) {
        $arr['attach'] = json_encode($arr['attach']);
    }
    $arr['account_id'] = x($arr, 'account_id') ? intval($arr['account_id']) : 0;
    $arr['mid'] = x($arr, 'mid') ? notags(trim($arr['mid'])) : random_string();
    $arr['from_xchan'] = x($arr, 'from_xchan') ? notags(trim($arr['from_xchan'])) : '';
    $arr['to_xchan'] = x($arr, 'to_xchan') ? notags(trim($arr['to_xchan'])) : '';
    $arr['created'] = x($arr, 'created') !== false ? datetime_convert('UTC', 'UTC', $arr['created']) : datetime_convert();
    $arr['expires'] = x($arr, 'expires') !== false ? datetime_convert('UTC', 'UTC', $arr['expires']) : NULL_DATE;
    $arr['title'] = x($arr, 'title') ? notags(trim($arr['title'])) : '';
    $arr['parent_mid'] = x($arr, 'parent_mid') ? notags(trim($arr['parent_mid'])) : '';
    $arr['body'] = x($arr, 'body') ? trim($arr['body']) : '';
    $arr['mail_flags'] = x($arr, 'mail_flags') ? intval($arr['mail_flags']) : 0;
    if (!$arr['parent_mid']) {
        logger('mail_store: missing parent');
        $arr['parent_mid'] = $arr['mid'];
    }
    $r = q("SELECT `id` FROM mail WHERE `mid` = '%s' AND channel_id = %d LIMIT 1", dbesc($arr['mid']), intval($arr['channel_id']));
    if ($r) {
        logger('mail_store: duplicate item ignored. ' . print_r($arr, true));
        return 0;
    }
    call_hooks('post_mail', $arr);
    if (x($arr, 'cancel')) {
        logger('mail_store: post cancelled by plugin.');
        return 0;
    }
    dbesc_array($arr);
    logger('mail_store: ' . print_r($arr, true), LOGGER_DATA);
    $r = dbq("INSERT INTO mail (`" . implode("`, `", array_keys($arr)) . "`) VALUES ('" . implode("', '", array_values($arr)) . "')");
    // find the item we just created
    $r = q("SELECT `id` FROM mail WHERE `mid` = '%s' AND `channel_id` = %d ORDER BY `id` ASC ", $arr['mid'], intval($arr['channel_id']));
    if ($r) {
        $current_post = $r[0]['id'];
        logger('mail_store: created item ' . $current_post, LOGGER_DEBUG);
        $arr['id'] = $current_post;
        // for notification
    } else {
        logger('mail_store: could not locate created item');
        return 0;
    }
    if (count($r) > 1) {
        logger('mail_store: duplicated post occurred. Removing duplicates.');
        q("DELETE FROM mail WHERE `mid` = '%s' AND `channel_id` = %d AND `id` != %d ", $arr['mid'], intval($arr['channel_id']), intval($current_post));
    } else {
        require_once 'include/enotify.php';
        $notif_params = array('from_xchan' => $arr['from_xchan'], 'to_xchan' => $arr['to_xchan'], 'type' => NOTIFY_MAIL, 'item' => $arr, 'verb' => ACTIVITY_POST, 'otype' => 'mail');
        notification($notif_params);
    }
    call_hooks('post_mail_end', $arr);
    return $current_post;
}
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:61,代码来源:items.php


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