📄 album_set.inc
字号:
<?php
function dml_getcategory( &$nd, &$nodata, &$error, &$parr )
{
$term = true;
while ( $term )
{
$sql = "SELECT * FROM ALBUM_CATEGORY ";
if ( !$nd->executequery( $sql ) )
{
$term = false;
$nodata = false;
$error['msg'] = "插入错误。";
}
else
{
$term = $nd->getrecordset( );
break;
}
}
return $term;
}
function dml_getcategorynum( &$nd, &$nodata, &$error, &$parr )
{
$term = true;
while ( $term )
{
$sql = "SELECT COUNT(PID) CNUM FROM ALBUM_CATEGORY ";
if ( !$nd->executequery( $sql ) )
{
$term = false;
$nodata = false;
$error['msg'] = "插入错误。";
}
else
{
$term = $nd->getrecordset( );
break;
}
}
return $term;
}
function dml_setcategory( &$nd, &$nodata, &$error, &$parr )
{
$term = true;
while ( $term )
{
$sql = "INSERT INTO ALBUM_CATEGORY(PID,USR,TITLE,MANAGER,BROWSE,";
$sql .= " MAX_SPACE,CREATE_DATA)";
$sql .= " VALUES(0,'".$parr['usr']."','".$parr['title']."','".$parr['to_id']."',";
$sql .= "'".$parr['copy_to_id']."',".$parr['max_space'].",NOW())";
if ( $nd->executequery( $sql ) )
{
break;
}
$term = false;
$error['msg'] = "插入错误。";
break;
}
return $term;
}
function dml_checkalbumsubject( &$nd, &$nodata, &$error, &$parr )
{
$term = true;
while ( $term )
{
$sql = "SELECT COUNT(PID) CPID FROM ALBUM_SUBJECT WHERE ";
$sql .= " ALBUM_CATEGORY = ".$parr['pid']."";
if ( !$nd->executequery( $sql ) )
{
$term = false;
$nodata = false;
}
else
{
$term = $nd->getrecordset( );
break;
}
}
return $term;
}
function dml_delcategory( &$nd, &$nodata, &$error, &$parr )
{
$term = true;
while ( $term )
{
$sql = "DELETE FROM ALBUM_CATEGORY WHERE PID = ".$parr['pid']."";
if ( $nd->executequery( $sql ) )
{
break;
}
$term = false;
$error['msg'] = "插入错误。";
break;
}
$path = $_SERVER['DOCUMENT_ROOT'];
$dir = $path."attachment/album/".$parr['pid'];
$olddir = $parr['pid']."_".rand( 0, 1000 );
$destination = $path."attachment/album/".$olddir;
@rename( $dir, $destination );
return $term;
}
function dml_getcategoryinfo( &$nd, &$nodata, &$error, &$parr )
{
$term = true;
while ( $term )
{
$sql = "SELECT * FROM ALBUM_CATEGORY WHERE PID = ".$parr['pid']."";
if ( !$nd->executequery( $sql ) )
{
$term = false;
$nodata = false;
$error['msg'] = "插入错误。";
}
else
{
$term = $nd->getrecordset( );
$manager = str_replace( ",", "','", substr( $term[0]['MANAGER'], 0, strrpos( $term[0]['MANAGER'], "," ) ) );
$browse = str_replace( ",", "','", substr( $term[0]['BROWSE'], 0, strrpos( $term[0]['BROWSE'], "," ) ) );
$sql = "SELECT USER_NAME FROM USER WHERE USER_ID IN('".$manager."')";
if ( !$nd->executequery( $sql ) )
{
$term = false;
$nodata = false;
$error['msg'] = "查询错误。";
}
else
{
$mres = $nd->getrecordset( );
$i = 0;
for ( ; $i < count( $mres ); ++$i )
{
$musername[$i] = $mres[$i]['USER_NAME'];
}
$musername = implode( ",", $musername );
$sql = "SELECT USER_NAME FROM USER WHERE USER_ID IN('".$browse."')";
if ( !$nd->executequery( $sql ) )
{
$term = false;
$nodata = false;
$error['msg'] = "查询错误。";
}
else
{
$bres = $nd->getrecordset( );
$i = 0;
for ( ; $i < count( $bres ); ++$i )
{
$busername[$i] = $bres[$i]['USER_NAME'];
}
$busername = implode( ",", $busername );
$term[0]['musername'] = $musername.",";
$term[0]['busername'] = $busername.",";
break;
}
}
}
}
return $term;
}
function dml_modifycategoryinfo( &$nd, &$nodata, &$error, &$parr )
{
$term = true;
while ( $term )
{
$sql = "UPDATE ALBUM_CATEGORY SET TITLE = '".$parr['title']."',";
$sql .= "MAX_SPACE = ".$parr['max_space'].",";
$sql .= " MANAGER = '".$parr['manager']."',BROWSE = '".$parr['browse']."'";
$sql .= " WHERE PID = ".$parr['pid']."";
if ( $nd->executequery( $sql ) )
{
break;
}
$term = false;
$nodata = false;
$error['msg'] = "查询错误。";
break;
}
return $term;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -