Develop and Download Open Source Software

Browse CVS Repository

Diff of /xoonips/AL/commonal.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.94 by aga4096, Thu Jun 23 07:58:12 2005 UTC revision 1.95 by tani, Fri Jun 24 02:07:34 2005 UTC
# Line 22  Line 22 
22   *   *
23   * $Revision$   * $Revision$
24   * $Log$   * $Log$
25     * Revision 1.95  2005/06/24 02:07:34  tani
26     * insertItemDirectを定義(Import用)
27     * getPrivateItemIDに,BINDERを無視する条件を追加(個人バインダー対応)
28     *
29   * Revision 1.94  2005/06/23 07:58:12  aga4096   * Revision 1.94  2005/06/23 07:58:12  aga4096
30   * ・イベントログ機能の追加.   * ・イベントログ機能の追加.
31   *   *
# Line 445  static result_t deleteMemberNoLimit( ses Line 449  static result_t deleteMemberNoLimit( ses
449  static result_t getXoopsModuleConfigValue( const char *module, const char *key, char **value );  static result_t getXoopsModuleConfigValue( const char *module, const char *key, char **value );
450  static void setLastErrorString( const char* str );  static void setLastErrorString( const char* str );
451  static result_t checkTitleConflict( sessionid_t sid, indexid_t parentIndexID, const char *title, bool *conflict );  static result_t checkTitleConflict( sessionid_t sid, indexid_t parentIndexID, const char *title, bool *conflict );
452    static result_t _insertItem( sessionid_t sid, const item_t* item, itemid_t* itemid, bool direct );
453    
454  static void syslog_printf( char* format, ... )  static void syslog_printf( char* format, ... )
455  {  {
# Line 3528  result_t getSession( sessionid_t sid, co Line 3533  result_t getSession( sessionid_t sid, co
3533   * @return RES_NO_WRITE_ACCESS_RIGHT   * @return RES_NO_WRITE_ACCESS_RIGHT
3534   *   *
3535   */   */
3536    result_t insertItemDirect( sessionid_t sid, const item_t* item, itemid_t* itemid )
3537    {
3538        return _insertItem( sid, item, itemid, true );
3539    }
3540    
3541  result_t insertItem( sessionid_t sid, const item_t* item, itemid_t* itemid )  result_t insertItem( sessionid_t sid, const item_t* item, itemid_t* itemid )
3542  {  {
3543        return _insertItem( sid, item, itemid, false );
3544    }
3545    
3546    /**
3547     *
3548     * アイテム(Basic Information)を登録する.
3549     * Platformユーザ以上の権限が必要.
3550     *
3551     * @param sid セッションID
3552     * @param item 登録したいアイテムの情報
3553     * @param itemid 登録したアイテムのIDを受け取る引数
3554     * @param direct last_update_date, creation_dateもitem引数の内容に従うならtrue
3555     * @return RES_OK
3556     * @return RES_ERROR
3557     * @return RES_NO_SUCH_SESSION
3558     * @return RES_DB_QUERY_ERROR
3559     * @return RES_DB_NOT_INITIALIZED
3560     * @return RES_NO_WRITE_ACCESS_RIGHT
3561     *
3562     */
3563    static result_t _insertItem( sessionid_t sid, const item_t* item, itemid_t* itemid, bool direct )
3564    {
3565      if( hdbc == NULL ) return RES_DB_NOT_INITIALIZED;      if( hdbc == NULL ) return RES_DB_NOT_INITIALIZED;
3566      if( !isValidSessionID( sid ) ) return RES_NO_SUCH_SESSION;      if( !isValidSessionID( sid ) ) return RES_NO_SUCH_SESSION;
3567      if( !isActivatedBySession( sid ) ) return RES_NO_WRITE_ACCESS_RIGHT;      if( !isActivatedBySession( sid ) ) return RES_NO_WRITE_ACCESS_RIGHT;
# Line 4319  result_t getPrivateItemID( sessionid_t s Line 4351  result_t getPrivateItemID( sessionid_t s
4351      sql += " WHERE open_level<=" + unsignedIntToString( index::OL_GROUP_ONLY );      sql += " WHERE open_level<=" + unsignedIntToString( index::OL_GROUP_ONLY );
4352      sql += " AND certify_state=" + unsignedIntToString( index::CERTIFIED );      sql += " AND certify_state=" + unsignedIntToString( index::CERTIFIED );
4353      sql += " AND item_type_id !=" + unsignedIntToString( item::ITID_INDEX );      sql += " AND item_type_id !=" + unsignedIntToString( item::ITID_INDEX );
4354        sql += " AND item_type_id !=" + unsignedIntToString( item::ITID_BINDER );
4355      sql += " AND ( ti.uid=" + unsignedIntToString( sess_uid );      sql += " AND ( ti.uid=" + unsignedIntToString( sess_uid );
4356      sql +=       " OR is_admin=1 AND tgulink.uid=" + unsignedIntToString( sess_uid );      sql +=       " OR is_admin=1 AND tgulink.uid=" + unsignedIntToString( sess_uid );
4357      sql += ")";      sql += ")";
# Line 4333  result_t getPrivateItemID( sessionid_t s Line 4366  result_t getPrivateItemID( sessionid_t s
4366              string notin;              string notin;
4367              sql = "SELECT item_id FROM " + dbprefix + "_xoonips_item_basic";              sql = "SELECT item_id FROM " + dbprefix + "_xoonips_item_basic";
4368              sql += " WHERE item_type_id !=" + unsignedIntToString( item::ITID_INDEX );              sql += " WHERE item_type_id !=" + unsignedIntToString( item::ITID_INDEX );
4369                sql += " AND item_type_id !=" + unsignedIntToString( item::ITID_BINDER );
4370              sql += " AND uid=" + unsignedIntToString( sess_uid );              sql += " AND uid=" + unsignedIntToString( sess_uid );
4371              for( i = 0 ; ( sqlcode = SQLFetch( hstmt ) ) == SQL_SUCCESS ; i++ ){              for( i = 0 ; ( sqlcode = SQLFetch( hstmt ) ) == SQL_SUCCESS ; i++ ){
4372                  if( i > 0 ) notin += ", ";                  if( i > 0 ) notin += ", ";
# Line 4734  bool getCertifyPermission( sessionid_t s Line 4768  bool getCertifyPermission( sessionid_t s
4768          sql += " AND ti.item_id=" + unsignedIntToString( iid );          sql += " AND ti.item_id=" + unsignedIntToString( iid );
4769          sql += " AND tx.index_id=" + unsignedIntToString( xid );          sql += " AND tx.index_id=" + unsignedIntToString( xid );
4770          sql += " AND ( is_admin=1 AND tgulink.uid=" + unsignedIntToString( sess_uid );          sql += " AND ( is_admin=1 AND tgulink.uid=" + unsignedIntToString( sess_uid );
4771            sql += " OR item_type_id=" + unsignedIntToString( item::ITID_BINDER ); //すべてのバインダーを承認
4772      if( state == index_t::NOT_CERTIFIED )      if( state == index_t::NOT_CERTIFIED )
4773          sql += " OR ti.uid=" + unsignedIntToString( sess_uid );          sql += " OR ti.uid=" + unsignedIntToString( sess_uid );
4774      sql += string( isModerator( sid, sess_uid ) ? " OR 1)" : " OR 0)" ); //モデレータならOR 1,それ以外は OR 0      sql += string( isModerator( sid, sess_uid ) ? " OR 1)" : " OR 0)" ); //モデレータならOR 1,それ以外は OR 0
# Line 5124  static result_t getIndexesInternal( sess Line 5159  static result_t getIndexesInternal( sess
5159      SQLRETURN sqlcode;      SQLRETURN sqlcode;
5160      SQLHANDLE hstmt = NULL;          SQLHANDLE hstmt = NULL;    
5161            
5162        string groupTable = dbprefix + "_xoonips_groups";
5163      string groupUserLinkTable = dbprefix + "_xoonips_groups_users_link";      string groupUserLinkTable = dbprefix + "_xoonips_groups_users_link";
5164      string indexTable = dbprefix + "_xoonips_index";      string indexTable = dbprefix + "_xoonips_index";
5165      string itemTable = dbprefix + "_xoonips_item_basic";      string itemTable = dbprefix + "_xoonips_item_basic";
# Line 5141  static result_t getIndexesInternal( sess Line 5177  static result_t getIndexesInternal( sess
5177          " FROM " + indexTable + " AS tx " +          " FROM " + indexTable + " AS tx " +
5178          " LEFT JOIN " + itemTable + " AS ti on tx.index_id = ti.item_id "          " LEFT JOIN " + itemTable + " AS ti on tx.index_id = ti.item_id "
5179          " LEFT JOIN " + groupUserLinkTable + " AS tlink on tlink.gid = tx.gid and tlink.uid = " + uidString +          " LEFT JOIN " + groupUserLinkTable + " AS tlink on tlink.gid = tx.gid and tlink.uid = " + uidString +
5180          " WHERE " + accessRightCond + " AND " + cond;          " LEFT JOIN " + groupTable + " AS tg on tx.gid = tg.gid "
5181            " WHERE " + accessRightCond + " AND ( tx.open_level != 2 OR tx.open_level = 2 AND tg.gid IS NOT NULL ) AND " + cond;
5182      SQLLEN len = 0;      SQLLEN len = 0;
5183      result = countResultRows( sql.c_str(), &len );      result = countResultRows( sql.c_str(), &len );
5184      if ( result != RES_OK )      if ( result != RES_OK )

Legend:
Removed from v.1.94  
changed lines
  Added in v.1.95

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26