diff options
| author | Nick Palmer <nick@sluggardy.net> | 2007-03-05 02:19:54 +0000 |
|---|---|---|
| committer | Nick Palmer <nick@sluggardy.net> | 2007-03-05 02:19:54 +0000 |
| commit | 7f7d658ddf04bad83f17867d1e4d952e9446a1f3 (patch) | |
| tree | 9ecbde11fdd8eef9d3f9c9b66d3b23efb65d68eb /Pigeonholes.php | |
| parent | 00613a642f9f88969f0a8cbfda5672b601ddba15 (diff) | |
| download | pigeonholes-7f7d658ddf04bad83f17867d1e4d952e9446a1f3.tar.gz pigeonholes-7f7d658ddf04bad83f17867d1e4d952e9446a1f3.tar.bz2 pigeonholes-7f7d658ddf04bad83f17867d1e4d952e9446a1f3.zip | |
Fix issues with assign content I broke before. Add forbid insert feature. Fix bug with insert when there are no checks on the page. Need to add better security on insert still but the interface doesn't offer it now.
Diffstat (limited to 'Pigeonholes.php')
| -rw-r--r-- | Pigeonholes.php | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/Pigeonholes.php b/Pigeonholes.php index 797b4fe..450afe2 100644 --- a/Pigeonholes.php +++ b/Pigeonholes.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.81 2007/03/03 21:19:52 nickpalmer Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_pigeonholes/Pigeonholes.php,v 1.82 2007/03/05 02:19:54 nickpalmer Exp $ * * +----------------------------------------------------------------------+ * | Copyright ( c ) 2004, bitweaver.org @@ -17,7 +17,7 @@ * Pigeonholes class * * @author xing <xing@synapse.plus.com> - * @version $Revision: 1.81 $ + * @version $Revision: 1.82 $ * @package pigeonholes */ @@ -260,9 +260,21 @@ class Pigeonholes extends LibertyContent { * @TODO We need to sort the returned values that successive pigoenholes are grouped together. */ function getPigeonholesPathList( $pContentId=NULL, $pTruncate = FALSE ) { + global $gBitSystem; + $where = $join = ''; + + if ($gBitSystem->isFeatureActive('pigeonholes_allow_forbid_insertion')) { + $where .= empty( $where ) ? ' WHERE ' : ' AND '; + $where .= ' lcp.`pref_value` IS NULL OR lcp.`pref_value` != \'on\' '; + $join .= ' LEFT JOIN `'.BIT_DB_PREFIX.'liberty_content_prefs` lcp ON (pig.`content_id` = lcp.`content_id` AND lcp.`pref_name` = \'no_insert\') '; + } + + $query = "SELECT pig.`content_id`, pig.`structure_id` FROM `".BIT_DB_PREFIX."pigeonholes` pig INNER JOIN `".BIT_DB_PREFIX."liberty_structures` ls ON ( ls.`structure_id` = pig.`structure_id` ) + $join + $where ORDER BY ls.`root_structure_id`, ls.`structure_id` ASC"; $result = $this->mDb->query( $query ); $pigeonholes = $result->getRows(); @@ -379,7 +391,7 @@ class Pigeonholes extends LibertyContent { LibertyContent::prepGetList( $pListHash ); $ret = $bindVars = array(); - $where = $order = $join = ''; + $where = $order = $join = $select = ''; if( @BitBase::verifyId( $pListHash['root_structure_id'] ) ) { $where .= empty( $where ) ? ' WHERE ' : ' AND '; @@ -404,6 +416,13 @@ class Pigeonholes extends LibertyContent { $bindVars[] = $pListHash['title']; } + if ($gBitSystem->isFeatureActive('pigeonholes_allow_forbid_insertion') && !empty( $pListHash['insertable'] ) ) { + $where .= empty( $where ) ? ' WHERE ' : ' AND '; + $where .= ' lcp.`pref_value` IS NULL OR lcp.`pref_value` != \'on\' '; + $join .= ' LEFT JOIN `'.BIT_DB_PREFIX.'liberty_content_prefs` lcp ON (lc.`content_id` = lcp.`content_id` AND lcp.`pref_name` = \'no_insert\') '; + $select .= ' , lcp.`pref_value` as no_insert '; + } + if( isset( $pListHash['parent_id'] ) ) { $where .= empty( $where ) ? ' WHERE ' : ' AND '; $where .= ' ls.`parent_id` = ? '; @@ -430,7 +449,7 @@ class Pigeonholes extends LibertyContent { $query = "SELECT pig.*, ls.`root_structure_id`, ls.`parent_id`, lc.`title`, lc.`data`, lc.`user_id`, lc.`content_type_guid`, uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name, - uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name + uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name $select FROM `".BIT_DB_PREFIX."pigeonholes` pig INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON ( lc.`content_id` = pig.`content_id` ) LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON ( uue.`user_id` = lc.`modifier_user_id` ) @@ -650,6 +669,10 @@ class Pigeonholes extends LibertyContent { } // individual pigeonhole preference store + global $gBitSystem; + if( $gBitSystem->isFeatureActive('pigeonholes_allow_forbid_insertion') && empty( $pParamHash['prefs']['no_insert'] ) ) { + $pParamHash['prefs']['no_insert'] = '0'; + } $pParamHash['preferences_store'] = !empty( $pParamHash['prefs'] ) ? $pParamHash['prefs'] : NULL; // structure store |
