wiki
[ class tree: wiki ] [ index: wiki ] [ all elements ]

Source for file copyrights_lib.php

Documentation is available at copyrights_lib.php

  1. <?php
  2. /**
  3.  * Copyright (c) 2004 bitweaver.org
  4.  * Copyright (c) 2003 tikwiki.org
  5.  * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  6.  * All Rights Reserved. See below for details and a complete list of authors.
  7.  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  8.  *
  9.  * @package wiki
  10.  */
  11.  
  12. /**
  13.  * @package wiki
  14.  * @subpackage CopyrightsLib
  15.  */
  16. class CopyrightsLib extends BitBase {
  17.     function list_copyrights$pPageId {
  18.         $query "select * from `".BIT_DB_PREFIX."liberty_copyrights` WHERE `page_id`=? order by ".$this->mDb->convertSortmode"copyright_order_asc" );
  19.         $query_cant "select count(*) from `".BIT_DB_PREFIX."liberty_copyrights` WHERE `page_id`=?";
  20.         $result $this->mDb->query($queryarray$pPageId ));
  21.         $cant $this->mDb->getOne($query_cantarray$pPageId ));
  22.         $ret array();
  23.         while ($res $result->fetchRow()) {
  24.             $ret[$res;
  25.         }
  26.         $retval array();
  27.         $retval["data"$ret;
  28.         $retval["cant"$cant;
  29.         return $retval;
  30.     }
  31.     function top_copyright_order$pPageId {
  32.         $query "select MAX(`copyright_order`) from `".BIT_DB_PREFIX."liberty_copyrights` where `page_id` = ?";
  33.         return $this->mDb->getOne($queryarray$pPageId ));
  34.     }
  35.     function unique_copyright$pPageId $title{
  36.         $query "select `copyrightID` from `".BIT_DB_PREFIX."liberty_copyrights` where `page_id`=? and `title`=?";
  37.         return $this->mDb->getOne($queryarray$pPageId ,$title));
  38.     }
  39.     function add_copyright$pPageId $title$year$authors$pUserId{
  40.         //$unique = $this->unique_copyright( $pPageId ,$title);
  41.         //if($unique != 0) {
  42.         // security here?
  43.         //$this->edit_copyright($unique,$title,$year,$authors,$pUserId);
  44.         //return;
  45.         //}
  46.         $top $this->top_copyright_order$pPageId );
  47.         $order $top 1;
  48.         $query "insert into `".BIT_DB_PREFIX."liberty_copyrights` (`page_id`, `title`, `copyright_year`, `authors`, `copyright_order`, `user_id`) values (?,?,?,?,?,?)";
  49.         $this->mDb->query($query,array$pPageId ,$title,$year,$authors,$order,$pUserId));
  50.         return true;
  51.     }
  52.     function edit_copyright($id$title$year$authors$pUserId{
  53.         $query "update `".BIT_DB_PREFIX."liberty_copyrights` SET `copyright_year`=?, `title`=?, `authors`=?, `user_id`=? where `copyright_id`=?";
  54.         $this->mDb->query($query,array($year,$title,$authors,$pUserId,(int)$id));
  55.         return true;
  56.     }
  57.     function remove_copyright($id{
  58.         $query "delete from `".BIT_DB_PREFIX."liberty_copyrights` where `copyright_id`=?";
  59.         $this->mDb->query($query,array((int)$id));
  60.         return true;
  61.     }
  62.     function up_copyright($id{
  63.         $query "update `".BIT_DB_PREFIX."liberty_copyrights` set `copyright_order`=`copyright_order`-1 where `copyright_id`=?";
  64.         $result $this->mDb->query($query,array((int)$id));
  65.         return true;
  66.     }
  67.     function down_copyright($id{
  68.         $query "update `".BIT_DB_PREFIX."liberty_copyrights` set `copyright_order`=`copyright_order`+1 where `copyright_id`=?";
  69.         $result $this->mDb->query($query,array((int)$id));
  70.         return true;
  71.     }
  72. }
  73.  
  74. global $copyrightslib;
  75. $copyrightslib new CopyrightsLib();
  76.  
  77. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:16 +0000 by phpDocumentor 1.5.0-lsces