diff options
Diffstat (limited to 'includes/copyrights_lib.php')
| -rwxr-xr-x[-rw-r--r--] | includes/copyrights_lib.php | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/includes/copyrights_lib.php b/includes/copyrights_lib.php index ef8d1be..122506c 100644..100755 --- a/includes/copyrights_lib.php +++ b/includes/copyrights_lib.php @@ -13,28 +13,31 @@ * @package wiki * @subpackage CopyrightsLib */ +namespace Bitweaver\Wiki; +use Bitweaver\BitBase; + class CopyrightsLib extends BitBase { function list_copyrights( $pPageId ) { $query = "select * from `".BIT_DB_PREFIX."liberty_copyrights` WHERE `page_id`=? order by ".$this->mDb->convertSortmode( "copyright_order_asc" ); $query_cant = "select count(*) from `".BIT_DB_PREFIX."liberty_copyrights` WHERE `page_id`=?"; - $result = $this->mDb->query($query, array( $pPageId )); - $cant = $this->mDb->getOne($query_cant, array( $pPageId )); - $ret = array(); + $result = $this->mDb->query($query, [ $pPageId ] ); + $cant = $this->mDb->getOne($query_cant, [ $pPageId ] ); + $ret = []; while ($res = $result->fetchRow()) { $ret[] = $res; } - $retval = array(); + $retval = []; $retval["data"] = $ret; $retval["cant"] = $cant; return $retval; } function top_copyright_order( $pPageId ) { $query = "select MAX(`copyright_order`) from `".BIT_DB_PREFIX."liberty_copyrights` where `page_id` = ?"; - return $this->mDb->getOne($query, array( $pPageId )); + return $this->mDb->getOne($query, [ $pPageId ] ); } function unique_copyright( $pPageId , $title) { $query = "select `copyrightID` from `".BIT_DB_PREFIX."liberty_copyrights` where `page_id`=? and `title`=?"; - return $this->mDb->getOne($query, array( $pPageId ,$title)); + return $this->mDb->getOne($query, [ $pPageId ,$title ] ); } function add_copyright( $pPageId , $title, $year, $authors, $pUserId) { //$unique = $this->unique_copyright( $pPageId ,$title); @@ -46,32 +49,30 @@ class CopyrightsLib extends BitBase { $top = $this->top_copyright_order( $pPageId ); $order = $top + 1; $query = "insert into `".BIT_DB_PREFIX."liberty_copyrights` (`page_id`, `title`, `copyright_year`, `authors`, `copyright_order`, `user_id`) values (?,?,?,?,?,?)"; - $this->mDb->query($query,array( $pPageId ,$title,$year,$authors,$order,$pUserId)); + $this->mDb->query($query,[ $pPageId ,$title,$year,$authors,$order,$pUserId ] ); return true; } function edit_copyright($id, $title, $year, $authors, $pUserId) { $query = "update `".BIT_DB_PREFIX."liberty_copyrights` SET `copyright_year`=?, `title`=?, `authors`=?, `user_id`=? where `copyright_id`=?"; - $this->mDb->query($query,array($year,$title,$authors,$pUserId,(int)$id)); + $this->mDb->query($query,[ $year,$title,$authors,$pUserId,(int)$id] ); return true; } function remove_copyright($id) { $query = "delete from `".BIT_DB_PREFIX."liberty_copyrights` where `copyright_id`=?"; - $this->mDb->query($query,array((int)$id)); + $this->mDb->query($query,[ (int)$id ] ); return true; } function up_copyright($id) { $query = "update `".BIT_DB_PREFIX."liberty_copyrights` set `copyright_order`=`copyright_order`-1 where `copyright_id`=?"; - $result = $this->mDb->query($query,array((int)$id)); + $result = $this->mDb->query($query,[ (int)$id ] ); return true; } function down_copyright($id) { $query = "update `".BIT_DB_PREFIX."liberty_copyrights` set `copyright_order`=`copyright_order`+1 where `copyright_id`=?"; - $result = $this->mDb->query($query,array((int)$id)); + $result = $this->mDb->query($query,[ (int)$id ] ); return true; } } global $copyrightslib; $copyrightslib = new CopyrightsLib(); - -?> |
