本文整理汇总了PHP中cpg_db_query函数的典型用法代码示例。如果您正苦于以下问题:PHP cpg_db_query函数的具体用法?PHP cpg_db_query怎么用?PHP cpg_db_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpg_db_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cpgUserLastComment
function cpgUserLastComment($uid)
{
global $CONFIG;
$result = cpg_db_query("SELECT count(*), MAX(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} as c, {$CONFIG['TABLE_PICTURES']} as p WHERE c.pid = p.pid AND approval='YES' AND author_id = '{$uid}' {$FORBIDDEN_SET}");
$nbEnr = mysql_fetch_array($result);
$comment_count = $nbEnr[0];
$lastcom_id = $nbEnr[1];
mysql_free_result($result);
$lastcom = '';
if ($comment_count) {
$sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body, approval " . "FROM {$CONFIG['TABLE_COMMENTS']} AS c, {$CONFIG['TABLE_PICTURES']} AS p " . "WHERE msg_id='" . $lastcom_id . "' AND approval = 'YES' AND c.pid = p.pid";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$row = mysql_fetch_array($result);
mysql_free_result($result);
$pic_url = get_pic_url($row, 'thumb');
if (!is_image($row['filename'])) {
$image_info = cpg_getimagesize(urldecode($pic_url));
$row['pwidth'] = $image_info[0];
$row['pheight'] = $image_info[1];
}
$image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
$mime_content = cpg_get_type($row['filename']);
$lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
}
}
$lastComArray = array();
$lastComArray['thumb'] = $lastcom;
$lastComArray['comment'] = $row['msg_body'];
$lastComArray['msg_date'] = $row['msg_date'];
$lastComArray['count'] = $comment_count;
return $lastComArray;
}
示例2: quick_tag_page_html
function quick_tag_page_html($html)
{
global $CONFIG;
$num_keywords = 10;
$keywords_array = array();
$keyword_count = array();
$result = cpg_db_query("SELECT keywords FROM {$CONFIG['TABLE_PICTURES']} WHERE keywords <> ''");
if (mysql_num_rows($result)) {
while (list($keywords) = mysql_fetch_row($result)) {
$array = explode($CONFIG['keyword_separator'], html_entity_decode($keywords));
foreach ($array as $word) {
if (!trim($word)) {
continue;
}
if (!in_array($word = utf_strtolower($word), $keywords_array)) {
$keywords_array[] = $word;
$keyword_count[$word] = 1;
} else {
$keyword_count[$word]++;
}
}
}
arsort($keyword_count);
}
$i = 0;
$buttons = '';
foreach ($keyword_count as $keyword => $count) {
if ($i++ >= $num_keywords) {
break;
}
$buttons .= "<span class=\"admin_menu\" style=\"white-space: nowrap;\" onclick=\"jQuery('#keywords\\1').focus(); jQuery('#keywords\\1').val(jQuery('#keywords\\1').val() + '{$CONFIG['keyword_separator']}{$keyword}{$CONFIG['keyword_separator']}');\">{$keyword}</span> ";
}
$html = preg_replace('/<input type="text" style="width: 100%" name="keywords([0-9]+)?".* \\/>/U', "\\0<p></p>" . $buttons, $html);
return $html;
}
示例3: album_share_codes_main
function album_share_codes_main()
{
$superCage = Inspekt::makeSuperCage();
if ($superCage->get->testInt('album')) {
global $CONFIG;
$aid = $superCage->get->getInt('album');
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = '{$aid}'");
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$url = $CONFIG['ecards_more_pic_target'] . 'displayimage.php?pid=' . $row['pid'];
$thumb = $CONFIG['ecards_more_pic_target'] . get_pic_url($row, 'thumb');
$content1 .= '[url=' . $url . '][img]' . $thumb . '[/img][/url]' . "\n";
$content2 .= '<a href="' . $url . '"><img src="' . $thumb . ' /></a>' . "\n";
}
starttable(-1, 'Share codes for <i>all files</i> in this album');
echo <<<EOT
<tr>
<td class="tableb">
<tt>[url][img][/url]</tt>: <textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">{$content1}</textarea>
<br />
<tt><a><img></a></tt>: <textarea onfocus="this.select();" onclick="this.select();" class="textinput" rows="1" cols="64" wrap="off" style="overflow:hidden; height:15px;">{$content2}</textarea>
</td>
</tr>
EOT;
endtable();
}
}
}
示例4: alb_get_subcat_data
/**
* alb_get_subcat_data()
*
* @param integer $parent
* @param string $ident
**/
function alb_get_subcat_data($parent, $ident = '')
{
global $CONFIG, $CAT_LIST, $USER_DATA;
// select cats where the users can change the albums
$groups = '';
foreach ($USER_DATA['groups'] as $group) {
$groups .= "group_id = '{$group}' OR ";
}
$groups .= "0";
$result = cpg_db_query("SELECT cid, name, description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE parent = '{$parent}' AND cid != 1 ORDER BY pos");
if ($result->numRows() > 0) {
$rowset = cpg_db_fetch_rowset($result);
foreach ($rowset as $subcat) {
if (!GALLERY_ADMIN_MODE) {
$check_group = cpg_db_query("SELECT group_id FROM {$CONFIG['TABLE_CATMAP']} WHERE ({$groups}) AND cid = " . $subcat['cid']);
$check_group_rowset = cpg_db_fetch_rowset($check_group);
if ($check_group_rowset) {
$CAT_LIST[] = array($subcat['cid'], $ident . $subcat['name']);
}
} else {
$CAT_LIST[] = array($subcat['cid'], $ident . $subcat['name']);
}
alb_get_subcat_data($subcat['cid'], $ident . ' ');
}
}
}
示例5: create_hist_table
function create_hist_table()
{
global $CONFIG;
$tabname = $CONFIG['TABLE_PREFIX'] . "fullsize_hist";
$query = "CREATE TABLE IF NOT EXISTS " . $tabname . " (" . "`id` int(10) unsigned NOT NULL auto_increment," . "`uid` int(10) unsigned NOT NULL default '0'," . "`tstamp` datetime NOT NULL default '0000-00-00 00:00:00'," . "`picname` varchar(255) NOT NULL default ''," . "`ip` varchar(20) NOT NULL default ''," . "PRIMARY KEY (`id`)," . "UNIQUE KEY `multi` (`uid`,`picname`)" . ") ENGINE=MyISAM";
cpg_db_query($query);
}
示例6: photo_shop_fetch_user
function photo_shop_fetch_user($oid)
{
global $CONFIG, $udb_var;
$sql = "SELECT s.*, u.{$udb_var['field']['username']}, u.{$udb_var['field']['email']} FROM {$CONFIG['TABLE_SHOP']} AS s LEFT JOIN {$udb_var['usertable']} as u ON u.{$udb_var['field']['user_id']} = s.uid WHERE oid=" . $oid . " AND cd=1 AND s.uid=" . USER_ID . " LIMIT 1";
$result = cpg_db_query($sql, $this->link_id);
return $result;
}
示例7: cpgUserLastComment
function cpgUserLastComment($uid)
{
global $CONFIG, $FORBIDDEN_SET;
$result = cpg_db_query("SELECT COUNT(*), MAX(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE approval = 'YES' AND author_id = '{$uid}' {$FORBIDDEN_SET}");
list($comment_count, $lastcom_id) = mysql_fetch_row($result);
mysql_free_result($result);
$lastComArray = array('count' => 0);
if ($comment_count) {
$sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE msg_id = {$lastcom_id}";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$row = mysql_fetch_assoc($result);
$pic_url = get_pic_url($row, 'thumb');
if (!is_image($row['filename'])) {
$image_info = cpg_getimagesize(urldecode($pic_url));
$row['pwidth'] = $image_info[0];
$row['pheight'] = $image_info[1];
}
$image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
$lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
$lastComArray = array('thumb' => $lastcom, 'comment' => $row['msg_body'], 'msg_date' => $row['msg_date'], 'count' => $comment_count);
}
mysql_free_result($result);
}
return $lastComArray;
}
示例8: getDateLink
function getDateLink($day, $month, $year)
{
global $CONFIG, $lang_calendar_php;
$superCage = Inspekt::makeSuperCage();
$date = sprintf('%s-%02s-%02s', $year, $month, $day);
$query = "SELECT COUNT(pid) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND substring(from_unixtime(ctime),1,10) = '" . substr($date, 0, 10) . "' {$META_ALBUM_SET}";
$result = cpg_db_query($query);
$nb_pics = mysql_result($result, 0, 0);
if ($matches = $superCage->get->getMatched('action', '/^[a-z]+$/')) {
$action = $matches[0];
} elseif ($matches = $superCage->post->getMatched('action', '/^[a-z]+$/')) {
$action = $matches[0];
} else {
$action = '';
}
if ($action == 'browsebydate') {
if ($nb_pics) {
$link = '<a href="#" onclick="sendDate(\'' . $month . '\', \'' . $day . '\', \'' . $year . '\');" class="user_thumb_infobox" title="' . $nb_pics . ' ' . $lang_calendar_php['files'] . '">';
} else {
$link = '';
}
} else {
$link = "<a href=\"#\" onclick=\"sendDate('" . $month . "', '" . $day . "', '" . $year . "');\" class=\"user_thumb_infobox\" >";
}
return $link;
}
示例9: plugin_dst_datetime_update
function plugin_dst_datetime_update($dst_array)
{
global $CONFIG;
foreach ($dst_array as $value) {
if ($CONFIG['plugin_dst_country'] == $value['country']) {
$datetime = date('Y-m-d H:i:s');
$previoustime = '';
foreach ($value['data'] as $selected_array) {
$starttime = current($selected_array);
$endtime = next($selected_array);
if ($datetime >= $starttime && $datetime <= $endtime) {
// We have a winner - it's currently DST and we have a time zone difference
$CONFIG['plugin_dst_datetime'] = $endtime;
$CONFIG['plugin_dst_on'] = '1';
} elseif ($datetime > $previoustime && $datetime < $starttime) {
// We're out of the DST time range, i.e. in winter on the norther hemisphere
$CONFIG['plugin_dst_datetime'] = $starttime;
$CONFIG['plugin_dst_on'] = '0';
}
$previoustime = $endtime;
}
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_dst_datetime']}' WHERE name='plugin_dst_datetime'");
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value='{$CONFIG['plugin_dst_on']}' WHERE name='plugin_dst_on'");
}
}
}
示例10: minicms
function minicms($content = '')
{
global $MINICMS, $CONFIG, $cat, $album, $REFERER, $lang_minicms, $HTML_SUBST_DECODE, $cms_array;
if ($MINICMS['dbver'] != MINICMS_DBVER) {
echo "<h2>{$lang_minicms['minicms_full']} {$MINICMS['dbver']}</h2><br />{$lang_minicms['dbver_nomatch']}: " . MINICMS_DBVER . "<br />";
minicms_configure(false);
//auto-updater and dont print the "go" button
}
$where = isset($MINICMS['ID']) ? "ID='{$MINICMS['ID']}'" : "conid='{$MINICMS['conid']}' AND type='{$MINICMS['type']}'";
$query = "SELECT * FROM {$CONFIG['TABLE_CMS']} WHERE {$where} ORDER BY cpos";
$result = cpg_db_query($query);
$cms_array = cpg_db_fetch_rowset($result);
$counter = 0;
foreach ($cms_array as $key => $cms) {
$cms_array[$key]['next_ID'] = $counter < count($cms_array) - 1 && $cms['type'] == $cms_array[$counter + 1]['type'] && $cms['conid'] == $cms_array[$counter + 1]['conid'] ? '&id2=' . $cms_array[$counter + 1]['ID'] : '';
$cms_array[$key]['prev_ID'] = $counter > 0 && $cms['type'] == $cms_array[$counter - 1]['type'] && $cms['conid'] == $cms_array[$counter - 1]['conid'] ? '&id2=' . $cms_array[$counter - 1]['ID'] : '';
$cms_array[$key]['content'] = html_entity_decode(stripslashes($cms['content']));
$counter++;
}
ob_start();
theme_minicms($cms_array);
//$content.=ob_get_clean();
$content = ob_get_clean();
return $content;
}
示例11: edit_pic_views_after_edit_file
function edit_pic_views_after_edit_file($pid)
{
global $CONFIG;
$hits = get_post_var('hits', $pid);
if (is_numeric($hits) && $hits >= 0) {
cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET hits = '{$hits}' WHERE pid = {$pid} LIMIT 1");
}
}
示例12: check_files_uninstall
function check_files_uninstall()
{
global $CONFIG;
cpg_db_query("DROP TABLE IF EXISTS {$CONFIG['TABLE_PREFIX']}plugin_check_files_additional");
cpg_db_query("DROP TABLE IF EXISTS {$CONFIG['TABLE_PREFIX']}plugin_check_files_dirs");
cpg_db_query("DROP TABLE IF EXISTS {$CONFIG['TABLE_PREFIX']}plugin_check_files_missing");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name LIKE 'plugin_check_files_%'");
return true;
}
示例13: exif_parse_file
function exif_parse_file($filename)
{
global $CONFIG, $lang_picinfo;
//String containing all the available exif tags.
$exif_info = "AFFocusPosition|Adapter|ColorMode|ColorSpace|ComponentsConfiguration|CompressedBitsPerPixel|Contrast|CustomerRender|DateTimeOriginal|DateTimedigitized|DigitalZoom|DigitalZoomRatio|ExifImageHeight|ExifImageWidth|ExifInteroperabilityOffset|ExifOffset|ExifVersion|ExposureBiasValue|ExposureMode|ExposureProgram|ExposureTime|FNumber|FileSource|Flash|FlashPixVersion|FlashSetting|FocalLength|FocusMode|GainControl|IFD1Offset|ISOSelection|ISOSetting|ISOSpeedRatings|ImageAdjustment|ImageDescription|ImageSharpening|LightSource|Make|ManualFocusDistance|MaxApertureValue|MeteringMode|Model|NoiseReduction|Orientation|Quality|ResolutionUnit|Saturation|SceneCaptureMode|SceneType|Sharpness|Software|WhiteBalance|YCbCrPositioning|xResolution|yResolution";
if (!is_readable($filename)) {
return false;
}
$size = @getimagesize($filename);
if ($size[2] != 2) {
return false;
}
// Not a JPEG file
$exifRawData = explode("|", $exif_info);
$exifCurrentData = explode("|", $CONFIG['show_which_exif']);
//Let's build the string of current exif values to be shown
$showExifStr = "";
foreach ($exifRawData as $key => $val) {
if ($exifCurrentData[$key] == 1) {
$showExifStr .= "|" . $val;
}
}
//Check if we have the data of the said file in the table
$sql = "SELECT * FROM {$CONFIG['TABLE_EXIF']} " . "WHERE filename='" . addslashes($filename) . "'";
$result = cpg_db_query($sql);
if (mysql_num_rows($result) > 0) {
$row = mysql_fetch_array($result);
mysql_free_result($result);
$exifRawData = unserialize($row["exifData"]);
} else {
// No data in the table - read it from the image file
$exifRawData = read_exif_data_raw($filename, 0);
// Insert it into table for future reference
$sql = "INSERT INTO {$CONFIG['TABLE_EXIF']} " . "VALUES ('" . addslashes($filename) . "', '" . addslashes(serialize($exifRawData)) . "')";
$result = cpg_db_query($sql);
}
$exif = array();
if (is_array($exifRawData['IFD0'])) {
$exif = array_merge($exif, $exifRawData['IFD0']);
}
if (is_array($exifRawData['SubIFD'])) {
$exif = array_merge($exif, $exifRawData['SubIFD']);
}
if (is_array($exifRawData['SubIFD']['MakerNote'])) {
$exif = array_merge($exif, $exifRawData['SubIFD']['MakerNote']);
}
$exif['IFD1OffSet'] = $exifRawData['IFD1OffSet'];
$exifParsed = array();
foreach ($exif as $key => $val) {
if (strpos($showExifStr, "|" . $key) && isset($val)) {
$exifParsed[$lang_picinfo[$key]] = $val;
//$exifParsed[$key] = $val;
}
}
ksort($exifParsed);
return $exifParsed;
}
示例14: cpgpicdownload_configure
function cpgpicdownload_configure()
{
global $CONFIG;
if (!isset($CONFIG['cpgpicdownload'])) {
$setting = 'anonymous';
$sql = "INSERT INTO {$CONFIG['TABLE_CONFIG']} VALUES ('cpgpicdownload','{$setting}');";
$CONFIG['cpgpicdownload'] = $setting;
cpg_db_query($sql);
}
}
示例15: iframe_upload_uninstall
function iframe_upload_uninstall()
{
global $CONFIG;
$CONFIG['allowed_doc_types'] = str_replace('/iframe', $CONFIG['allowed_doc_types']);
$CONFIG['allowed_doc_types'] = str_replace('iframe/', '', $CONFIG['allowed_doc_types']);
$CONFIG['allowed_doc_types'] = str_replace('iframe', '', $CONFIG['allowed_doc_types']);
cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '{$CONFIG['allowed_doc_types']}' WHERE name = 'allowed_doc_types'");
cpg_db_query("DELETE FROM {$CONFIG['TABLE_FILETYPES']} WHERE extension = 'iframe'");
return true;
}