本文整理汇总了PHP中XoopsUser::incrementPost方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsUser::incrementPost方法的具体用法?PHP XoopsUser::incrementPost怎么用?PHP XoopsUser::incrementPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsUser
的用法示例。
在下文中一共展示了XoopsUser::incrementPost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_post_data
function process_post_data()
{
global $_POST, $xoopsModuleConfig, $xoopsDB;
global $user_albums_list, $xoopsModule, $myts;
$user_album_set = array();
foreach ($user_albums_list as $album) {
$user_album_set[$album['aid']] = 1;
}
if (!is_array($_POST['pid'])) {
redirect_header('index.php', 2, _MD_PARAM_MISSING);
}
$pid_array =& $_POST['pid'];
foreach ($pid_array as $pid) {
$pid = (int) $pid;
$aid = (int) get_post_var('aid', $pid);
$title = get_post_var('title', $pid);
$caption = get_post_var('caption', $pid);
$keywords = get_post_var('keywords', $pid);
$user1 = get_post_var('user1', $pid);
$user2 = get_post_var('user2', $pid);
$user3 = get_post_var('user3', $pid);
$user4 = get_post_var('user4', $pid);
$delete = isset($_POST['delete' . $pid]);
$reset_vcount = isset($_POST['reset_vcount' . $pid]);
$reset_votes = isset($_POST['reset_votes' . $pid]);
$del_comments = isset($_POST['del_comments' . $pid]) || $delete;
$query = "SELECT category, filepath, filename, owner_id FROM " . $xoopsDB->prefix("xcgal_pictures") . ", " . $xoopsDB->prefix("xcgal_albums") . " WHERE " . $xoopsDB->prefix("xcgal_pictures") . ".aid = " . $xoopsDB->prefix("xcgal_albums") . ".aid AND pid='{$pid}'";
$result = $xoopsDB->query($query);
if (!$xoopsDB->getRowsNum($result)) {
redirect_header('index.php', 2, _MD_NON_EXIST_AP);
}
$pic = $xoopsDB->fetchArray($result);
$xoopsDB->freeRecordSet($result);
if (!USER_IS_ADMIN) {
if ($pic['category'] != FIRST_USER_CAT + USER_ID) {
redirect_header('index.php', 2, _MD_PERM_DENIED . "<br />(picture category = {$pic['category']}/ {$pid})");
}
if (!isset($user_album_set[$aid])) {
redirect_header('index.php', 2, _MD_PERM_DENIED . "<br />(target album = {$aid})");
}
}
$update = "aid = '" . $aid . "'";
$update .= ", title = '" . $myts->makeTboxData4Save($title) . "'";
$update .= ", caption = '" . $myts->makeTareaData4Save($caption, 0) . "'";
$update .= ", keywords = '" . $myts->makeTboxData4Save($keywords) . "'";
$update .= ", user1 = '" . $myts->makeTboxData4Save($user1) . "'";
$update .= ", user2 = '" . $myts->makeTboxData4Save($user2) . "'";
$update .= ", user3 = '" . $myts->makeTboxData4Save($user3) . "'";
$update .= ", user4 = '" . $myts->makeTboxData4Save($user4) . "'";
if ($reset_vcount) {
$update .= ", hits = '0'";
}
if ($reset_votes) {
$update .= ", pic_rating = '0', votes = '0'";
}
if (UPLOAD_APPROVAL_MODE) {
$approved = get_post_var('approved', $pid);
if ($approved == 'YES') {
$update .= ", approved = 'YES'";
} elseif ($approved == 'DELETE') {
$del_comments = 1;
$delete = 1;
}
}
if ($del_comments) {
//$query = "DELETE FROM ".$xoopsDB->prefix("xcgal_comments")." WHERE pid='$pid'";
//$result =$xoopsDB->query($query);
xoops_comment_delete($xoopsModule->getVar('mid'), $pid);
}
if ($delete) {
$dir = $xoopsModuleConfig['fullpath'] . $pic['filepath'];
$file = $pic['filename'];
if (!is_writable($dir)) {
redirect_header('index.php', 2, sprintf(_MD_DIRECTORY_RO, $dir));
}
$files = array($dir . $file, $dir . $xoopsModuleConfig['normal_pfx'] . $file, $dir . $xoopsModuleConfig['thumb_pfx'] . $file);
foreach ($files as $currFile) {
if (is_file($currFile)) {
@unlink($currFile);
}
}
$query = "DELETE FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE pid='{$pid}' LIMIT 1";
$result = $xoopsDB->query($query);
} else {
$query = "UPDATE " . $xoopsDB->prefix("xcgal_pictures") . " SET {$update} WHERE pid='{$pid}' LIMIT 1";
$result = $xoopsDB->query($query);
if ($pic['owner_id'] != 0) {
$submitter = new XoopsUser($pic['owner_id']);
$submitter->incrementPost();
}
}
}
}
示例2: dirname
function d3download_approval_insertdb( $mydirname, $myparams )
{
require_once dirname( dirname(__FILE__) ).'/class/db_download.php' ;
require_once dirname( dirname(__FILE__) ).'/include/common_functions.php' ;
include_once dirname( dirname(__FILE__) ).'/include/upload_functions.php' ;
$db =& Database::getInstance() ;
global $xoopsUser , $xoopsModuleConfig ;
// Initialization
$error = 0 ;
foreach ( $myparams as $key=>$value ){ $$key = $value; }
// MAKE LINK SQL
if( ! empty( $requestid ) && empty( $modify ) && empty( $lid ) ) {
$new_lid = $db->genId($db->prefix( $mydirname."_downloads" )."_lid_seq");
$make_link = new db_download( $db->prefix( $mydirname."_downloads" ) , "lid", $new_lid ) ;
$newid = $make_link->db_insert( $set4sql );
if( empty( $newid ) ) $error = $requestid ;
d3download_convert_for_newid( $mydirname, $newid, $post_url, $post_file2, $submitter );
// Category title
include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ;
$mycategory = new MyCategory( $mydirname, 'Show', $cid ) ;
$ctitle = $mycategory->return_title() ;
// Define tags for notification message
$tags = array();
$tags = array(
'POSTER_UNAME' => $postname ,
'POST_TITLE' => $title ,
'POST_BODY' => $body ,
'POST_URL' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?page=singlefile&cid=' . $cid . '&lid=' . $newid,
'CAT_TITLE' => $ctitle ,
'CAT_URL' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?cid=' . $cid ,
) ;
d3download_main_trigger_event( $mydirname , 'global' , 0 , 'newpost' , $tags, 0 ) ;
d3download_main_trigger_event( $mydirname , 'category' , $cid , 'newpost' , $tags, 0 ) ;
d3download_main_trigger_event( $mydirname , 'category' , $cid , 'newpostfull' , $tags, 0 ) ;
if( ! empty( $notify ) ){
d3download_main_trigger_event( $mydirname , 'global' , $requestid , 'approve' , $tags, 0 ) ;
}
// Increment Post
if( $submitter > 0 && ! empty( $xoopsModuleConfig['plus_posts'] ) ) {
$user = new XoopsUser( $submitter ) ;
$user->incrementPost() ;
}
} elseif( ! empty( $requestid ) && ! empty( $modify ) && ! empty( $lid ) ) {
// UPDATE SQL
$make_link = new db_download( $db->prefix( $mydirname."_downloads" ) , "lid", $lid ) ;
$count = $make_link->db_getrowsnum( $lid );
if( $count > 0 ){
require_once dirname( dirname(__FILE__) ).'/class/history_download.php' ;
$history = new history_download( $mydirname ) ;
$history->history_Insert_DB( $lid ) ;
$result = $make_link->db_update( $set4sql, $lid );
if( ! $result ) $error = $lid ;
$history->history_Delete( $lid ) ;
if( ! empty( $notify ) ){
// Define tags for notification message
$tags = array();
$tags = array(
'POST_TITLE' => $title ,
'POST_URL' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?page=singlefile&cid=' . $cid . '&lid=' . $lid,
) ;
d3download_main_trigger_event( $mydirname , 'global' , $lid , 'approve' , $tags, 0 ) ;
}
}
}
$sql = "SELECT COUNT(*) FROM ".$db->prefix( $mydirname."_unapproval" )." WHERE requestid='".$requestid."'";
list( $count ) = $db->fetchRow( $db->query( $sql ) );
if( $count > 0 ){
$sql = "DELETE FROM ".$db->prefix($mydirname."_unapproval")." WHERE requestid = ".$requestid;
$result = $db->query($sql);
if( ! $result ) $error = $requestid ;
}
d3download_delete_cache_of_categories( $mydirname ) ;
redirect_header( XOOPS_URL."/modules/$mydirname/admin/index.php?page=approvalmanager" , 2 , $error ? sprintf( _MD_D3DOWNLOADS_ERROR_MESSEAGE , $error ) : _MD_D3DOWNLOADS_SUBMIT_APPROVED ) ;
exit();
}