Changeset 111
- Timestamp:
- 06/06/07 00:46:42 (1 year ago)
- Files:
-
- folio/folio/config.php (modified) (3 diffs)
- folio/folio/control/commentbox.php (modified) (2 diffs)
- folio/folio/control/commentbox_postdata.php (modified) (1 diff)
- folio/folio/control/crossbrowsercom (deleted)
- folio/folio/control/feeds.php (modified) (5 diffs)
- folio/folio/control/page_edit_post.php (modified) (2 diffs)
- folio/folio/control/tree.php (modified) (7 diffs)
- folio/folio/control/tree_getdata.php (modified) (3 diffs)
- folio/folio/html/feeds.php (modified) (3 diffs)
- folio/folio/html/setupdb.php (modified) (1 diff)
- folio/folio/html/view.php (modified) (5 diffs)
- folio/folio/lib.php (modified) (21 diffs)
- folio/folio/page_edit_menu.php (modified) (1 diff)
- folio/folio/page_info_menu.php (modified) (1 diff)
- folio/folio/readme.txt (modified) (6 diffs)
- folio/folio/todo.txt (modified) (2 diffs)
- folio/folio/users_info_menu.php (modified) (4 diffs)
- folio/readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
folio/folio/config.php
r101 r111 1 1 <?php 2 // Folio Setup Options 2 3 3 // Folio Setup & Options4 4 global $CFG; 5 $FOLIO_CFG->version = 0.6; 6 $FOLIO_CFG->ajaxprefix = 'folio_control_tree_'; 5 7 6 // DEPRECIATED 7 // THIS OPTION WAS DISABLED IN ELGG V.7 & FOLIO V.5 DUE TO COMPATABILITY PROBLEMS. 8 // SETTING TO Y WILL NO LONGER WORK. 9 // Do you want to have a 'dropdown' menu for the 'Wiki Pages' link on the side-menu? 10 // Allowable options are 'Y' and 'N' 11 $FOLIO_CFG->wiki_menu_dropdown = 'N'; 12 // END DEPRECIATED 13 14 // Do you want to include 'Recent Changes' in the menu for a page? Should probably be 'Y' 15 // if you are not using the wiki_menu_dropdown options, otherwise, there is no easy way 16 // to see the move recently updated pages. 17 // Allowable options are 'Y' and 'N' 18 $FOLIO_CFG->wiki_menu_recentchanges = 'Y'; 8 /////////////////////////////////////////////////////////////////////////////////////// 9 // WIKI OPTIONS 10 /////////////////////////////////////////////////////////////////////////////////////// 19 11 20 12 // Default permission level for a new page. Can be PUBLIC, MODERATED, or PRIVATE 21 13 $FOLIO_CFG->page_defaultpermission = 'MODERATED'; 14 15 /////////////////////////////////////////////////////////////////////////////////////// 16 // LOGGING OPTIONS 17 /////////////////////////////////////////////////////////////////////////////////////// 22 18 23 19 // One way of improving Apache logs is to add the user's username to each entry. … … 29 25 apache_note('username',$_SESSION['username']); 30 26 31 // Add a menu link for the Chatbox add-in32 // Allowable options are 'Y' and 'N'33 $FOLIO_CFG->chatbox_installed = 'N';34 35 // Disable the following menu links.36 // If you do not want to disable certain options, leave the array empty. Do not comment out37 // the variable.38 // Some common options are 'dashboard', 'feeds' <- subscriptions, 'folio' <- wiki page link, 'folio_feeds' <- activity39 $FOLIO_CFG->disabled_menuitems = array();40 41 27 // Folio has the option to keep track a historical record of user logons. 42 28 // If you want to track this data, then set this option to "Y". If you put it 43 29 // as 'N', then old logons will be deleted. 44 $FOLIO_CFG->track_logons = 'Y'; 30 $FOLIO_CFG->track_logons = 'N'; 31 32 33 /////////////////////////////////////////////////////////////////////////////////////// 34 // SIDEBAR DISPLAY OPTIONS 35 /////////////////////////////////////////////////////////////////////////////////////// 36 37 // Disable menu links. 38 // If you do not want to disable certain options, leave the array empty. Do not comment out 39 // the variable. 40 41 // TOP MENU 42 // Some common options are 'feeds' <- subscriptions, 'folio' <- wiki page link, 'folio_feeds' <- activity 43 $FOLIO_CFG->disabled_topmenuitems = array(); 44 45 // SIDE MENU 46 // Standard options are: (include the path) 47 // $CFG->dirroot . "mod/blog/lib/weblogs_user_info_menu.php" <--- Elgg above v.8 has /mod/ instead of /units/ 48 // $CFG->dirroot . "mod/file/lib/files_user_info_menu.php" 49 // These are normally disabled, as the folio side-menu replaces their functionality. However, if you want these, 50 // then remove them from the following array. In addition, change the FOLIO_CFG->disabled_foliomenuitems variable 51 // to keep that from showing them. 52 $FOLIO_CFG->disabled_sidemenuitems = 53 array( $CFG->dirroot . 'mod/blog/lib/weblogs_user_info_menu.php', // Elgg 8 54 $CFG->dirroot . 'mod/file/lib/files_user_info_menu.php', // Elgg 8 55 $CFG->dirroot . 'units/weblogs/weblogs_user_info_menu.php', // Elgg 7 56 $CFG->dirroot . 'units/files/files_user_info_menu.php' // Elgg 7 57 ); 58 59 60 61 // If you are having troubles finding the particular include needed, set the following to true to print out the names of the included files. 62 $FOLIO_CFG->debug_print_sidemenu_includes = false; // true 63 64 // FOLIO MENU 65 // This can be used to disable certain elements from the wiki folio sidemenu. As an example, if you decide to have 66 // the normal blog sidebar shown, then you will want to not show the wiki blog link. 67 // Options ( 'weblog', 'files', 'profile', 'wiki' ) 68 $FOLIO_CFG->disabled_foliomenuitems = array() ; //array( 'profile','weblog','files','wiki' ); 69 70 71 /////////////////////////////////////////////////////////////////////////////////////// 72 // FRONTPAGE DISPLAY OPTIONS 73 /////////////////////////////////////////////////////////////////////////////////////// 74 45 75 46 76 // Folio has the option to keep show a custom log-on page. It will show 47 77 // recent activity counts & global data.If you want to show this instead 48 78 // of the default php value, then set this option to "Y". 49 $FOLIO_CFG->template_frontpage = ' Y';79 $FOLIO_CFG->template_frontpage = 'N'; 50 80 51 81 // Folio has the option to keep show a custom log-on page. The following variable … … 57 87 <p align='center'><br/><a href='{wwwroot}activity/inbox/{username}/html/all/all/1'><img src='{wwwroot}mod/folio/image/inbox.png' border=0/></a></p>"; 58 88 89 59 90 ?> folio/folio/control/commentbox.php
r101 r111 19 19 $item_title = folio_page_encodetitle( $item_title ); 20 20 $item_owner_username = folio_page_encodetitle( $item_owner_username ); 21 21 22 // Get access level for item 23 $item = get_record_select('folio_page_security',"security_ident = {$item_ident}"); 24 25 if (!$item) { 26 trigger_error("Invalid item ident {$item_ident} passed to /mod/folio/control/commentbox.php "); die(); 27 } 28 $access = $item->accesslevel; 29 30 // Set accesslevel to public if moderated, as from a reader's perspective, that's the same thing. 31 if ( $access == 'MODERATED' ) { 32 $access = 'PUBLIC'; 33 } 34 22 35 /* This is now passed as $item_owner_ident 23 36 if (logged_on) { … … 57 70 function {$ajaxprefix}makeRequest(){ 58 71 var postData = "item_ident={$item_ident}&item_type={$item_type}" + 59 "&item_owner_name={$item_owner_name}&item_owner_username={$item_owner_username}&access= public&url={$item_url}&item_owner_ident={$item_owner_ident}&item_title={$item_title}&body=" +72 "&item_owner_name={$item_owner_name}&item_owner_username={$item_owner_username}&access={$access}&url={$item_url}&item_owner_ident={$item_owner_ident}&item_title={$item_title}&body=" + 60 73 escape( document.{$ajaxprefix}form.{$ajaxprefix}comment.value ); 61 74 var request = YAHOO.util.Connect.asyncRequest('POST', "{$url}", {$ajaxprefix}callback, postData); folio/folio/control/commentbox_postdata.php
r101 r111 68 68 'Comment by ' . $comment->creator_username . ' on ' . $comment->item_title, 69 69 $comment->body, 70 $url ) ;70 $url, $comment->access ) ; 71 71 72 72 // Return wrapped up. folio/folio/control/feeds.php
r101 r111 134 134 $date = gmdate("D M d",intval($result->created)); 135 135 $type = str_replace( '_', ' ', $result->type ); 136 $iconid = user_info("icon", $result->user_ident); 136 137 137 138 $html .= <<< END … … 139 140 <td width="70" valign="top"> 140 141 <a href="{$CFG->wwwroot}{$result->user_username}"> 141 <img alt="" src="{$CFG->wwwroot}_icon/user/{$ result->user_ident}/h/50/w/50" border="0"/>142 <img alt="" src="{$CFG->wwwroot}_icon/user/{$iconid}/h/50/w/50" border="0"/> 142 143 </a> 143 144 </td> … … 163 164 164 165 if ( $page < $pages ) { 165 $result .= "<a href='" . ($page + 1) . "'><< Back</a> ";166 $result .= "<a href='" . ($page + 1) . "'><< Older</a> "; 166 167 } 167 168 … … 169 170 170 171 if ( $page > 1 ) { 171 $result .= "<a href='" . ($page - 1) . "'> Forward>></a> ";172 $result .= "<a href='" . ($page - 1) . "'>Newer >></a> "; 172 173 } 173 174 … … 231 232 232 233 // src="{$url}{$result->user_username}/icons/{$icon}/h/67/w/67" 233 $iconurl = $CFG->wwwroot . "_icon/user/" . $result->user_ident. '/h/50/w/50';234 $iconurl = $CFG->wwwroot . "_icon/user/" . user_info("icon",$result->user_ident) . '/h/50/w/50'; 234 235 235 236 /* folio/folio/control/page_edit_post.php
r101 r111 69 69 $security = optional_param('folio_control_page_edit_security_custom', 'PUBLIC'); 70 70 if ( $security == 'PRIVATE' ) { 71 if ( folio_finduser( $username )->user_type == 'community' ) { 71 $u = folio_finduser( $username ); 72 if ( $u->user_type == 'community' ) { 72 73 $security = 'community' . $page->user_ident; 73 74 } else { … … 80 81 $tags = trim($tags); 81 82 insert_tags_from_string ($tags, 'page', $page->page_ident, $security, $page->user_ident); 82 83 84 // We want to delete RSS records of changes to this page by this user within the last hour UNLESS they're by an anonymous user 85 if ( $page->creator_ident <> -1 ) { 86 rss_deleteitem( 'page', $page->page_ident, $page->creator_ident, 3600 ); 87 } 88 83 89 // Create RSS record 84 90 rss_additem( $page->user_ident, $username, folio/folio/control/tree.php
r101 r111 21 21 * Get current node's other child nodes, passing the previously created (down) node 22 22 as an argument so that it won't be built 2x. 23 * repeat until we hit this trees base node (where parentpage_ident == page_ident). 23 * repeat until we hit this trees base node (where parentpage_ident == page_ident). Don't create a node for the root, as that's already in the menu by default. 24 24 * 25 25 * NOTE: Calling functions SHOULD NOT SET $previouspage_ident. … … 71 71 if ( $page->children == 1 ) { 72 72 $result = folio_control_tree_getNodeChildren( $ajaxprefix, $page_ident, $previouspage_ident, $url, $result, $profile_id); 73 $result .= "\n{$ajaxprefix}Node{$page_ident}.expand();\n";74 73 } 75 74 … … 87 86 // Add code to automatically expand. 88 87 $result = str_replace("%{$page_ident}root%", "root", $result); 89 $result .= "\n{$ajaxprefix}Node{$page_ident}.expand();\n";90 88 91 89 } else { … … 175 173 176 174 /** 177 * Public code that should be called to create a tree .175 * Public code that should be called to create a tree from an arbitrary node. 178 176 * 179 177 * @param $page_ident Required, the root node being shown. 180 178 * @param $page_title Required, the name of the root node being shown. 181 179 * @param $username The name of the user/community to whom this page belongs. 180 * @param $page_id The id of the page to expand 182 181 */ 183 function folio_control_tree( $page_ident, $page_title, $username ) {182 function folio_control_tree( $page_ident, $page_title, $username, $page_id =-1 ) { 184 183 // Note: Do not change the name of the root node to anything but root without also changing it in the helper functions in this file. 185 184 global $CFG; 186 185 global $metatags; 187 global $ajaxprefix; 186 global $FOLIO_CFG; 187 $address = $CFG->wwwroot . 'mod/folio/'; 188 189 // Used by the different php functions in this file to prefix all of the ajax stuff being output to the screen. 190 // May eventually be used to allow for including a number of instances of this control on a single page. 191 $ajaxprefix = $FOLIO_CFG->ajaxprefix; 192 193 // Add CSS link. 194 $metatags .= "\n<link rel=\"stylesheet\" type=\"text/css\" " . 195 "href=\"{$address}css/treeview.css.php\" />"; 196 197 // Build javascript to load parent information. 198 $buildNodes = folio_control_tree_getNodes( $ajaxprefix, $page_ident ); 199 200 // BUILD JAVASCRIPT 201 $body = folio_tree_js( $ajaxprefix, $buildNodes, $page_id ); 202 203 // return 204 return $body; 205 206 /* 207 208 <!-- width: 40%; float: right; --> 209 padding:3px;margin-left: 0.5em;"> --> 210 <!-- <div class="infoholder" style="border: 1px solid #7F9DB9; 211 <!-- </div> --> 212 213 214 * In case I need the code for the 'contract all', here it is 215 <div id="expandcontractdiv" onload="javascript:treeInit()"> 216 <a href="javascript:tree.collapseAll()">Collapse all</a> 217 </div> 218 */ 219 } 220 221 /** 222 * Public code that should be called to create a tree from the root node. 223 * 224 * @param $userid int The userid of the user/community to whom this page belongs. 225 */ 226 function folio_control_roottree( $userid, $username ) { 227 global $CFG; 228 global $metatags; 188 229 $address = $CFG->wwwroot . 'mod/folio/'; 189 230 … … 197 238 198 239 // Build javascript to load parent information. 199 $buildNodes = folio_control_tree_getNode s( $ajaxprefix, $page_ident);240 $buildNodes = folio_control_tree_getNodeAtRoot( $ajaxprefix, $userid, $username ); 200 241 201 242 // BUILD JAVASCRIPT 202 $body = <<< END 243 $body = folio_tree_js( $ajaxprefix, $buildNodes ); 244 245 // return 246 return $body; 247 248 /* 249 250 <!-- width: 40%; float: right; --> 251 padding:3px;margin-left: 0.5em;"> --> 252 <!-- <div class="infoholder" style="border: 1px solid #7F9DB9; 253 <!-- </div> --> 254 255 256 * In case I need the code for the 'contract all', here it is 257 <div id="expandcontractdiv" onload="javascript:treeInit()"> 258 <a href="javascript:tree.collapseAll()">Collapse all</a> 259 </div> 260 */ 261 } 262 263 /** 264 * This function formats the title of a page in a suitable format for the treeview control 265 * As of Feb 2007, v.7 of Elgg forces a td.width declaration, which messes up the yahoo treeview control 266 * As a fix, I do a duplicate declaration to set td.width=10px. However, this means that the title needs to be 267 * forced to have the correct length. So, I use non-breaking spaces to fill it out. However, allowing some breaking 268 * spaces is a good idea, as otherwise it gets too long. So separate into chunks 269 * 270 * Note that this is re-defined in tree_getdata.php for that file's usage. 271 * $title Incoming title 272 **/ 273 function folio_tree_formattitle( $title ) { 274 // max len 275 //return $title; 276 $len = 25; 277 $temp = ''; 278 279 $title = str_replace("\"", "'", trim($title) ); 280 $parts = explode(' ', $title); 281 $title = ''; 282 283 foreach ( $parts as $part ) { 284 if ( strlen( $temp ) == 0 ) { 285 // Nothing in temp variable 286 $temp = $part; 287 } elseif ( ( strlen($temp) + strlen($part) ) < $len ) { 288 // Can join 289 $temp = $temp . '~' . $part; 290 } else { 291 // Too long. Make new temp & move old temp to return value. 292 $title = ltrim( $title . ' ' . $temp ); 293 $temp = $part; 294 } 295 } 296 // Move last temp to title 297 $title = str_replace( '~', ' ', trim( $title . ' ' . $temp ) ); 298 return $title; 299 } 300 301 /** 302 * This function contains all of the js for the tree control 303 * 304 * It is called by a couple of the functions that create trees. 305 * $ajaxprefix string The standard prefix for the js code namespace. 306 * $buildNodes string The pre-built nodes to create on the page. 307 **/ 308 function folio_tree_js( $ajaxprefix, $buildNodes, $page_id ) { 309 // Note: Do not change the name of the root node to anything but root without also changing it in the helper functions in this file. 310 global $CFG; 311 $address = $CFG->wwwroot . 'mod/folio/'; 312 313 return <<< END 203 314 204 315 <script type="text/javascript" src="{$address}control/yui/build/yahoo/yahoo.js" ></script> … … 218 329 // Add Nodes 219 330 $buildNodes 220 331 221 332 {$ajaxprefix}tree.draw(); 333 {$ajaxprefix}expand( $page_id ); 334 } 335 336 // Recursively expand this node & all parents. 337 function {$ajaxprefix}expand( nodeID ) { 338 var node = YAHOO.widget.TreeView.getTree( '{$ajaxprefix}treeDiv1').getNodeByProperty( 'id', nodeID ); 339 node.expand(); 340 if ( !node.isRoot() ) { 341 {$ajaxprefix}expand( node.parent.data.id ); 342 } 222 343 } 223 344 … … 317 438 </STYLE> 318 439 <div id='splitpanesidebar2'> 319 < b>Pages</b>440 <!-- <b>Pages</b> --> 320 441 <div id="{$ajaxprefix}treeDiv1"></div> 321 442 <img src="{$address}control/tree_blankimage.jpg" onload="javascript:{$ajaxprefix}treeInit()" /> 322 443 </div> 323 444 END; 324 325 // return 326 return $body; 327 328 /* 329 330 <!-- width: 40%; float: right; --> 331 padding:3px;margin-left: 0.5em;"> --> 332 <!-- <div class="infoholder" style="border: 1px solid #7F9DB9; 333 <!-- </div> --> 334 335 336 * In case I need the code for the 'contract all', here it is 337 <div id="expandcontractdiv" onload="javascript:treeInit()"> 338 <a href="javascript:tree.collapseAll()">Collapse all</a> 339 </div> 340 */ 341 } 342 343 /** 344 * This function formats the title of a page in a suitable format for the treeview control 345 * As of Feb 2007, v.7 of Elgg forces a td.width declaration, which messes up the yahoo treeview control 346 * As a fix, I do a duplicate declaration to set td.width=10px. However, this means that the title needs to be 347 * forced to have the correct length. So, I use non-breaking spaces to fill it out. However, allowing some breaking 348 * spaces is a good idea, as otherwise it gets too long. So separate into chunks 349 * 350 * Note that this is re-defined in tree_getdata.php for that file's usage. 351 * $title Incoming title 352 **/ 353 function folio_tree_formattitle( $title ) { 354 // max len 355 $len = 15; 356 $temp = ''; 357 358 $title = str_replace("\"", "'", $title ); 359 $parts = explode(' ', $title); 360 $title = ''; 361 362 foreach ( $parts as $part ) { 363 if ( ( strlen($temp) + strlen($part) ) < $len ) { 364 // Can join 365 $temp = $temp . '~' . $part; 366 } else { 367 // Too long. Make new temp & move old temp to return value. 368 $title = ltrim( $title . ' ' . $temp ); 369 $temp = $part; 370 } 371 } 372 373 // Move last temp to title 374 $title = str_replace( '~', ' ', trim( $title . ' ' . $temp ) ); 375 return $title; 445 376 446 } 377 447 folio/folio/control/tree_getdata.php
r101 r111 44 44 "WHERE w.parentpage_ident = $page_ident AND w.newest = 1 AND w.parentpage_ident <> w.page_ident AND " . 45 45 folio_page_security_where( 'p', 'w', 'read', $profile_id ) . 46 'ORDER BY title DESC, children DESC')46 'ORDER BY title ASC, children DESC') 47 47 ); 48 48 … … 93 93 function folio_tree_formattitle( $title ) { 94 94 // max len 95 $len = 15; 95 //return $title; 96 $len = 25; 96 97 $temp = ''; 97 98 98 $title = str_replace("\"", "'", $title);99 $title = str_replace("\"", "'", trim($title) ); 99 100 $parts = explode(' ', $title); 100 101 $title = ''; 101 102 102 103 foreach ( $parts as $part ) { 103 if ( ( strlen($temp) + strlen($part) ) < $len ) { 104 if ( strlen( $temp ) == 0 ) { 105 // Nothing in temp variable 106 $temp = $part; 107 } elseif ( ( strlen($temp) + strlen($part) ) < $len ) { 104 108 // Can join 105 109 $temp = $temp . '~' . $part; … … 110 114 } 111 115 } 112 113 116 // Move last temp to title 114 $title = str_replace( '~', ' ', trim( $title . ' ' . $temp ) ); 117 $title = str_replace( '~', ' ', trim( $title . ' ' . $temp ) ); 115 118 return $title; 116 119 } folio/folio/html/feeds.php
r101 r111 329 329 330 330 $body = folio_feeds_controlbox( $arguments, $page ) . 331 folio_control_htmlfeed( $results, $resultcount, $page, $ username);331 folio_control_htmlfeed( $results, $resultcount, $page, $arguments['username'] ); 332 332 333 333 // Transfer into template & write. … … 455 455 * Replace the variable referenced by Change to set to Value. Makes it easier for array 456 456 * processing. 457 * Note that if we are being told to remove the only value in the array that we will automatically 458 * select the wildcard. 457 459 * 458 460 * @param $changes array - An array of arrays= ('name', 'value') to arg array. … … 465 467 if ( is_array($arguments[$change['name']]) ) { 466 468 if ( in_array( $change['value'], $arguments[$change['name']]) ) { 469 // Remove 467 470 $arguments[$change['name']] = folio_delete_element( $arguments[$change['name']], $change['value'] ); 471 // Test to make sure that there is at least one option. 472 if ( count($arguments[$change['name']]) == 0 ) { 473 array_push( $arguments[$change['name']], 'all' ); 474 } 468 475 } else { 469 476 array_push($arguments[$change['name']], $change['value']); folio/folio/html/setupdb.php
r101 r111 33 33 34 34 // See if a user other than news is trying to run this. 35 if ($USER->username <> 'news') {36 error('You can only run this function if you logged on as "news"');37 die();38 }35 //if ($USER->username <> 'news') { 36 // error('You can only run this function if you logged on as "news"'); 37 // die(); 38 //} 39 39 40 40 // Start upgrading. folio/folio/html/view.php
r101 r111 17 17 require_once("../control/pagelist.php"); 18 18 require_once("../control/page_view_tags.php"); 19 require_once("../control/commentbox.php"); 19 20 20 21 run("profile:init"); … … 22 23 run("folio:init"); 23 24 25 global $CFG; 26 global $PAGE; 27 global $FOLIO_CFG; 28 24 29 // Retrieve passed variables (page name & user name, as well as created). 25 30 // These variables will be used by the menu system to build links. See lib.php for more details. … … 95 100 folio_page_view($page_ident,$page_title, -1, $page, $username); 96 101 102 // Add the edit option 103 $PAGE->menu_sub[] = array( 'name' => 'folio:edit', 104 'html' => a_hrefg( "{$CFG->wwwroot}$username/page/" . 105 folio_page_encodetitle($page_title) . "/edit", 106 "Edit Page")); 107 97 108 } else { 98 109 // Viewing an existing page. … … 109 120 folio_page_view_tags($page_ident) . 110 121 folio_control_childpagelist( $username, $page, $page_owner ) . 111 folio_control_commentlist( 'page', $page_ident); 122 folio_control_commentlist( 'page', $page_ident) . 123 folio_control_commentbox( $page_ident, 'page', $page_title, 124 url . $comment_on_username . '/page/' . folio_page_encodetitle( $page_title ), 125 $comment_on_ident, $comment_on_name, $comment_on_username); 126 127 // setup menu 128 // Looking at a page. 129 $PAGE->menu_sub[] = array( 'name' => 'folio:recentchanges', 130 'html' => a_hrefg( "{$CFG->wwwroot}activity/user/$username/summary/page+page_comment/all/1", 131 "Recent Changes")); 132 $PAGE->menu_sub[] = array( 'name' => 'folio:edit', 133 'html' => a_hrefg( "{$CFG->wwwroot}$username/page/" . 134 folio_page_encodetitle($page_title) . "/edit", 135 "Edit Page")); 136 $PAGE->menu_sub[] = array( 'name' => 'folio:history', 137 'html' => a_hrefg( "{$CFG->wwwroot}$username/page/" . 138 folio_page_encodetitle($page_title) . "/history", 139 "History")); 140 $PAGE->menu_sub[] = array( 'name' => 'folio:delete', 141 'html' => a_hrefg( "{$CFG->wwwroot}$username/page/" . 142 folio_page_encodetitle($page_title) . "/delete", 143 "Delete")); 144 145 // Setup Metatags for RSS Discovery 146 $metatags .= "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".url."$username/subscribe/rss/page+page_comment/\" />\n"; 147 148 149 150 // $body .= "\n<a href=\"javascript:alert( YAHOO.widget.TreeView.getTree( 151 // '{$FOLIO_CFG->ajaxprefix}treeDiv1').getNodeByProperty( 'id', '$page_ident' ) );\">Get Node</a>\n"; 152 153 // $body .= "\n<a href=\"\">Expand</a>\n"; 154 112 155 } 113 156 } else { … … 131 174 ) 132 175 ); 176 177 // Add JS to exand the tree control. 178 // $body .= "\n<img src='{$CFG->wwwroot}mod/folio/control/tree_blankimage.jpg' onload=\"javascript:{$FOLIO_CFG->ajaxprefix}expand( '$page_ident' );\"\>\n"; 133 179 134 180 echo templates_page_draw(array( folio/folio/lib.php
r101 r111 11 11 **/ 12 12 function folio_version() { 13 return 0.5; 13 global $FOLIO_CFG; 14 return $FOLIO_CFG->version; 14 15 } 15 16 … … 26 27 27 28 listen_for_event("weblog_post","publish","folio_rss_weblog_post"); 29 listen_for_event("weblog_post","update","folio_rss_weblog_post"); 28 30 listen_for_event("weblog_comment","publish","folio_rss_weblog_comment"); 29 31 listen_for_event("file","publish","folio_rss_file"); 30 32 listen_for_event("file","update","folio_rss_file"); 33 31 34 // Test to see if there has been a log-on event 32 35 $l = optional_param('username'); 33 36 $p = optional_param('password'); 34 37 35 // Test to see if a log-on event is going to occur thru cached credentials (or if they're already logged in, but 36 // the session variable with the replacement template code isn't being used). 37 // Also test to see if a logon form has been submitted, in which case, re-test 38 // against authenticate & then record the logon event. 39 if ( isloggedin() && !isset( $_SESSION['folio_template_frontpage'] ) ) { 40 // Login via cached information. 41 folio_record_logon(); 42 } else { 43 // Test to see if a logon-form has been submitted. 44 if (!empty($l) && !empty($p)) { 45 if ( authenticate_account($l, $p) ) { 46 folio_record_logon(); 38 if ( $FOLIO_CFG->track_logons == 'Y' OR $FOLIO_CFG->template_frontpage == 'Y' ) { 39 // Test to see if a log-on event is going to occur thru cached credentials (or if they're already logged in, but 40 // the session variable with the replacement template code isn't being used). 41 // Also test to see if a logon form has been submitted, in which case, re-test 42 // against authenticate & then record the logon event. 43 if ( isloggedin() && !isset( $_SESSION['folio_template_frontpage'] ) ) { 44 // Login via cached information. 45 folio_record_logon(); 46 } else { 47 // Test to see if a logon-form has been submitted. 48 if (!empty($l) && !empty($p)) { 49 if ( authenticate_account($l, $p) ) { 50 folio_record_logon(); 51 } 47 52 } 48 53 } … … 135 140 if (isloggedin() & defined('context') ) { 136 141 if ( substr(context, 0, 5) == "folio" & $username == $currentusername) { 137 138 // Show selected 142 // Show selected 139 143 $PAGE->menu[] = array( 'name' => 'folio', 140 144 'html' => '<li><a href="'.$CFG->wwwroot . $currentusername . '/page/" class="selected">Your Pages</a></li>'); 141 142 } else { 145 } else { 143 146 // Show main menu unselected 144 147 $PAGE->menu[] = array( 'name' => 'folio', 145 148 'html' => '<li><a href="'.$CFG->wwwroot . $currentusername . '/page/">Your Pages</a></li>'); 146 147 149 } 148 150 } elseif ( isloggedin() ) { … … 150 152 // Show link to folio. 151 153 $PAGE->menu[] = array( 'name' => 'folio', 152 'html' => '<li><a href="'.$CFG->wwwroot . $currentusername . '/page/">Your Pages</a>'); 153 154 'html' => '<li><a href="'.$CFG->wwwroot . $currentusername . '/page/">Your Pages</a></li>'); 154 155 } 155 156 … … 168 169 } elseif ( isloggedin() ) { 169 170 // Some pages don't have context defined. 170 // Show link to folio.171 // Show link to activity. 171 172 array_splice( $PAGE->menu, 0, 0, array( array( 'name' => 'folio_feeds', 172 173 'html' => '<li><a href="'.$CFG->wwwroot . 'activity/inbox/' . $currentusername . '/html/all/all/1">Your Activity</a></li>'))); 173 174 } 174 175 175 if ( defined('context') ) {176 if (substr(context, 0, 10) == 'folio_page') {177 // Looking at a page.178 // Look to see if we should include 'Recent Changes' as a menu option.179 if ($FOLIO_CFG->wiki_menu_recentchanges == 'Y') {180 $PAGE->menu_sub[] = array( 'name' => 'folio:recentchanges',181 'html' => a_hrefg( "{$CFG->wwwroot}activity/user/$username/summary/page+page_comment/all/1",182 "Recent Changes"));183 }184 $PAGE->menu_sub[] = array( 'name' => 'folio:edit',185 'html' => a_hrefg( "{$CFG->wwwroot}$username/page/" .186 folio_page_encodetitle($page_title) . "/edit",187 "Edit Page"));188 $PAGE->menu_sub[] = array( 'name' => 'folio:history',189 'html' => a_hrefg( "{$CFG->wwwroot}$username/page/" .190 folio_page_encodetitle($page_title) . "/history",191 "History"));192 $PAGE->menu_sub[] = array( 'name' => 'folio:delete',193 'html' => a_hrefg( "{$CFG->wwwroot}$username/page/" .194 folio_page_encodetitle($page_title) . "/delete",195 "Delete"));196 197 // Setup Metatags for RSS Discovery198 $metatags .= "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".url."$username/subscribe/rss/page+page_comment/\" />\n";199 }200 201 }202 176 203 177 // ------------------------------------------------------------- … … 207 181 // version used in this mod. 208 182 209 // Remove the weblog & file pane. 210 $function['display:sidebar'] = folio_delete_element( 211 $function['display:sidebar'], 212 $CFG->dirroot . "units/weblogs/weblogs_user_info_menu.php" 213 ); 214 215 $function['display:sidebar'] = folio_delete_element( 216 $function['display:sidebar'], 217 $CFG->dirroot . "units/files/files_user_info_menu.php" 218 ); 183 folio_prunetopmenu(); 184 folio_prunesidemenu(); 219 185 220 186 // Insert … … 418 384 * 419 385 * @param string $input 386 * @param array $valid Valid characterrs, defaults to standard -_() and spaces. 420 387 * @return string Clean input 421 388 **/ 422 function folio_clean( $input ) {389 function folio_clean( $input, $valid = array('(',')',' ','-','_',' ' )) { 423 390 424 391 $input = trim( $input ); 425 392 426 393 // Test for an easy clean / validation. 427 if ( ctype_alnum( str_replace( ' ', '', str_replace( ')', '', str_replace( '(', '', str_replace( '-', '', str_replace( '_', '', $input)) ) ) ) ) ){ 394 //Old Style:: str_replace( ' ', '', str_replace( ')', '', str_replace( '(', '', str_replace( '-', '', str_replace( '_', '', $input)) ) ) ) ) 395 if ( ctype_alnum( folio_clean_replace( $input, $valid ) ) ) { 428 396 // Validated. Return 429 397 return $input; … … 436 404 $v = substr( $input, $i, 1 ); 437 405 438 if ( ctype_alnum( $v ) | $v == '-' | $v == '_' | $v == '(' | $v ==')' | $v == ' ') {406 if ( ctype_alnum( $v ) | in_array( $v, $valid ) ) { 439 407 $retval .= $v; 440 408 } … … 444 412 } 445 413 } 414 415 /** 416 * Remove all of the valid_values in input & return the value 417 **/ 418 function folio_clean_replace( $input, $remove_values ) { 419 foreach ( $remove_values as $value) { 420 $input = str_replace( $value, '', $input ); 421 } 422 return $input; 423 } 424 425 446 426 /** 447 427 * Same as folio_clean, except suitable for array_walk … … 621 601 * Encoded urls should not be stored in the database. 622 602 * 623 * Also adds in YOUTUBE links. Should turn into an array instead of hardcoded, but this is 603 * Automatically removes invalid characters. 604 * 605 * Creates links to other user's wikis through [[username:page titles]] 606 * 607 * Adds in YOUTUBE links. Should turn into an array instead of hardcoded, but this is 624 608 * just a quick fix. 625 609 * 626 * @todo Implement some simple checks on the [[ ]] linking. Stuff like ]]] before [[..., title too long.627 610 * @param string $username The username of the owner of the page. 628 611 * @param string $body The body that we're translating. … … 635 618 while ( $i === true ) { 636 619 $i = stripos( $body, '[[' ); 637 $end = stripos( $body, ']]' ); 638 620 $end = stripos( $body, ']]' ); 621 $namespace = $username; 622 $nametag = ''; 623 639 624 // Test find. 640 625 if (!( $i === false | $end === false )) { 641 626 // Translate title. 642 $link = substr( $body, $i+2, $end -$i -2); 627 628 $link = substr( $body, $i+2, $end -$i -2) ; 629 $link = folio_clean( $link, array( '(',')','-','_',':',' ') ); 630 // Find namespace for link. 631 if ( $temp = stripos( $link, ':') ) { 632 $namespace = substr( $link, 0, $temp ); 633 $link = substr( $link, $temp+1, strlen($link) - $temp ); 634 $nametag = $namespace . ':'; 635 } 636 643 637 $body = substr( $body, 0, $i ) . 644 "<a href=\"{$url}{$ username}/page/" .638 "<a href=\"{$url}{$namespace}/page/" . 645 639 folio_page_encodetitle($link) . 646 "\"> $link</a>" .640 "\">{$nametag}{$link}</a>" . 647 641 substr( $body, $end+2 ); 648 642 … … 792 786 "or to create an online portfolio.\n\nYou can create links to new pages by simply " . 793 787 "enclosing the page title using double bracket characters ([ and ]). Here's an example " . 794 "of a link to this [[Home Page]]. ";788 "of a link to this [[Home Page]]. "; 795 789 $page->page_ident = $page_ident; 796 790 $page->security_ident = $page_ident; … … 857 851 /** 858 852 * Publish something to an RSS feed 853 * 859 854 * 860 855 * @param int owner_ident (int for the object owner) … … 897 892 } 898 893 894 895 /** 896 * Deletes all RSS feed entries with the given key and type. 897 * Called to prevent duplicate entries for rapidly edited documents. 898 * If calling with the user_ident and timespan, need to use both. 899 * 900 * @param string Type (url-able string, etc: weblog, file, wikipage) 901 * @param int Type_Ident 902 * @param int User_Ident (can be used to limit the deletion of the item to only the current user) 903 * @param int timespan (how far back to delete) 904 **/ 905 function rss_deleteitem( $type, $type_ident, $user_ident = -1, $timespan = -1 ) { 906 global $db, $CFG; 907 908 if ( $user_ident == -1 AND $timespan == -1 ) { 909 delete_records('folio_rss', 'type_ident', $type_ident, 'type', $type); 910 } else { 911 $stmt = $db->Prepare("DELETE FROM {$CFG->prefix}folio_rss where type = '{$type}' AND " . 912 "type_ident = {$type_ident} AND user_ident = {$user_ident} AND created > " . 913 (time() - $timespan )); 914 $returnvalue = $db->Execute($stmt); 915 } 916 } 917 918 899 919 /** 900 920 * Retrieve records from an rss feed. … … 1026 1046 1027 1047 //generate rss 1048 rss_deleteitem( $type, $type_ident ); 1028 1049 rss_additem( $owner_id, $owner_username, $user_id, $user_name, $user_username, $type, $type_ident, $tags, $title, $body, $link, $access); 1029 1050 … … 1047 1068 $owner_id = $post->weblog; 1048 1069 $owner_username = user_info("username", $owner_id); 1070 $access = $post->access; 1049 1071 1050 1072 // Get user info from db. … … 1069 1091 $user_id, $user_name, $user_username, 1070 1092 'weblog_comment', $object->ident, '', 1071 $title, $object->body, $link ); 1072 1073 } 1074  
