]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Merge r6301:6338 from 1.7 to trunk.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 4 Jun 2010 15:36:36 +0000 (15:36 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 4 Jun 2010 15:36:36 +0000 (15:36 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6356 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/elgglib.php
engine/lib/upgrades/2010060101.php [new file with mode: 0644]
engine/start.php
mod/defaultwidgets/views/default/defaultwidgets/editor.php
mod/notifications/start.php
mod/profile/views/default/profile/icon.php
simplecache/view.php
upgrade.php
version.php
views/default/canvas/layouts/widgets.php

index f890b3518b296ac3d5d3bf5d3209bf1fc369ec9e..e86b7a4c817373684bdb74e7e5ad9da0230f76f1 100644 (file)
@@ -431,12 +431,19 @@ function elgg_view_register_simplecache($viewname) {
 /**
  * Regenerates the simple cache.
  *
+ * @param string $viewtype Optional viewtype to regenerate
  * @see elgg_view_register_simplecache
  *
  */
-function elgg_view_regenerate_simplecache() {
+function elgg_view_regenerate_simplecache($viewtype = NULL) {
        global $CONFIG;
 
+       if (!isset($CONFIG->views->simplecache) || !is_array($CONFIG->views->simplecache)) {
+               return;
+       }
+
+       $lastcached = time();
+
        // @todo elgg_view() checks if the page set is done (isset($CONFIG->pagesetupdone)) and
        // triggers an event if it's not. Calling elgg_view() here breaks submenus
        // (at least) because the page setup hook is called before any
@@ -445,25 +452,35 @@ function elgg_view_regenerate_simplecache() {
        // the trigger correctly when the first view is actually being output.
        $CONFIG->pagesetupdone = TRUE;
 
-       if (isset($CONFIG->views->simplecache)) {
-               if (!file_exists($CONFIG->dataroot . 'views_simplecache')) {
-                       @mkdir($CONFIG->dataroot . 'views_simplecache');
-               }
+       if (!file_exists($CONFIG->dataroot . 'views_simplecache')) {
+               mkdir($CONFIG->dataroot . 'views_simplecache');
+       }
 
-               if (!empty($CONFIG->views->simplecache) && is_array($CONFIG->views->simplecache)) {
-                       foreach($CONFIG->views->simplecache as $view) {
-                               $viewcontents = elgg_view($view);
-                               $viewname = md5(elgg_get_viewtype() . $view);
-                               if ($handle = fopen($CONFIG->dataroot . 'views_simplecache/' . $viewname, 'w')) {
-                                       fwrite($handle, $viewcontents);
-                                       fclose($handle);
-                               }
+       if (isset($viewtype)) {
+               $viewtypes = array($viewtype);
+       } else {
+               $viewtypes = $CONFIG->view_types;
+       }
+
+       $original_viewtype = elgg_get_viewtype();
+       
+       foreach ($viewtypes as $viewtype) {
+               elgg_set_viewtype($viewtype);
+               foreach ($CONFIG->views->simplecache as $view) {
+                       $viewcontents = elgg_view($view);
+                       $viewname = md5(elgg_get_viewtype() . $view);
+                       if ($handle = fopen($CONFIG->dataroot . 'views_simplecache/' . $viewname, 'w')) {
+                               fwrite($handle, $viewcontents);
+                               fclose($handle);
                        }
                }
 
-               datalist_set('simplecache_lastupdate', 0);
+               datalist_set("simplecache_lastupdate_$viewtype", $lastcached);
+               datalist_set("simplecache_lastcached_$viewtype", $lastcached);
        }
 
+       elgg_set_viewtype($original_viewtype);
+
        unset($CONFIG->pagesetupdone);
 }
 
diff --git a/engine/lib/upgrades/2010060101.php b/engine/lib/upgrades/2010060101.php
new file mode 100644 (file)
index 0000000..7772c42
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+
+/**
+ * Clears old simplecache variables out of database
+ */
+
+$query = "DELETE FROM {$CONFIG->dbprefix}datalists WHERE name LIKE 'simplecache%'";
+
+delete_data($query);
+
+if ($CONFIG->simplecache_enabled) {
+       datalist_set('simplecache_enabled', 1);
+       elgg_view_regenerate_simplecache();
+} else {
+       datalist_set('simplecache_enabled', 0);
+}
index 8329c1e75630d62855bc4085839995a03926f02d..f5d3ce5e473c8cc6a33bc6deb8a3715f4a525a3b 100644 (file)
@@ -134,13 +134,9 @@ if (empty($oldview)) {
 }
 
 if (($installed) && ($db_installed)) {
-       $lastupdate = datalist_get('simplecache_lastupdate');
-       $lastcached = datalist_get('simplecache_'.$oldview);
+       $lastupdate = datalist_get("simplecache_lastupdate_$oldview");
+       $lastcached = datalist_get("simplecache_lastcached_$oldview");
        if ($lastupdate == 0 || $lastcached < $lastupdate) {
-               elgg_view_regenerate_simplecache();
-               $lastcached = time();
-               datalist_set('simplecache_lastupdate',$lastcached);
-               datalist_set('simplecache_'.$oldview,$lastcached);
+               elgg_view_regenerate_simplecache($oldview);
        }
-       $CONFIG->lastcache = $lastcached;
 }
index ef883ac01ffa2d99e3cf6df5226dbec12e03efbf..79a64193983c724dfc4d5ed4328227789c4bb31b 100644 (file)
@@ -82,8 +82,8 @@ $(document).ready(function () {
        </h3>
 </td>
 <td width="17px" align="right"></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14" height="14" class="more_info" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15" height="15" class="drag_handle" /></a></td>
 </tr></table>
 
 <?php
@@ -149,8 +149,8 @@ $(document).ready(function () {
                        </h3>
                </td>
                <td width="17px" align="right"></td>
-               <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
-               <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
+               <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14" height="14" class="more_info" /></a></td>
+               <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15" height="15" class="drag_handle" /></a></td>
                </tr></table>
                
                <?php
@@ -194,8 +194,8 @@ $(document).ready(function () {
        </h3>
 </td>
 <td width="17px" align="right"></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14" height="14" class="more_info" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15" height="15" class="drag_handle" /></a></td>
 </tr></table>
 
 <?php
@@ -235,8 +235,8 @@ $(document).ready(function () {
        </h3>
 </td>
 <td width="17px" align="right"></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14" height="14" class="more_info" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15" height="15" class="drag_handle" /></a></td>
 </tr></table>
 
 <?php
index 873095b8b8eb0300d29883eef1c429db7056b508..fa36d5d69b490071c2ec26b07fb0c0e0dcaa84f0 100644 (file)
@@ -23,6 +23,10 @@ function notifications_plugin_init() {
        // Unset the default notification settings
        unregister_plugin_hook('usersettings:save', 'user', 'notification_user_settings_save');
        elgg_unextend_view('usersettings/user', 'notifications/settings/usersettings');
+
+       // update notifications based on relationships changing
+       register_elgg_event_handler('delete', 'member', 'notifications_relationship_remove');
+       register_elgg_event_handler('delete', 'friend', 'notifications_relationship_remove');
 }
 
 /**
@@ -52,7 +56,7 @@ function notifications_page_handler($page) {
 }
 
 /**
- * Notification settings page setup function
+ * Notification settings sidebar menu
  *
  */
 function notifications_plugin_pagesetup() {
@@ -65,9 +69,29 @@ function notifications_plugin_pagesetup() {
        }
 }
 
+/**
+ * Update notifications when a relationship is deleted
+ *
+ * @param string $event
+ * @param string $object_type
+ * @param object $relationship
+ */
+function notifications_relationship_remove($event, $object_type, $relationship) {
+       global $NOTIFICATION_HANDLERS;
+
+       $user_guid = $relationship->guid_one;
+       $object_guid = $relationship->guid_two;
+
+       // loop through all notification types
+       foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+               remove_entity_relationship($user_guid, "notify{$method}", $object_guid);
+       }
+}
+
+
 
 register_elgg_event_handler('init', 'system', 'notifications_plugin_init', 1000);
 
-// Register action
+
 register_action("notificationsettings/save", FALSE, $CONFIG->pluginspath . "notifications/actions/save.php");
 register_action("notificationsettings/groupsave", FALSE, $CONFIG->pluginspath . "notifications/actions/groupsave.php");
index ef1b32b36d2feae7e6c4148775e1d04a801ce765..bca4499fc5bbc14fc68ed0dac75f055264bba791 100644 (file)
@@ -50,7 +50,7 @@ if ($vars['entity'] instanceof ElggUser) {
        if (!$override) {
        ?>      
                <div class="usericon <?php echo $vars['size']; ?>">
-               <div class="avatar_menu_button"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" border="0" width="15px" height="15px" /></div>
+               <div class="avatar_menu_button"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" border="0" width="15" height="15" /></div>
                <div class="sub_menu">
                        <h3 class="displayname"><a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo $vars['entity']->name; ?>
                        <span class="username"><?php echo "&#64;" . $vars['entity']->username; ?></span></a></h3>                       
@@ -104,7 +104,7 @@ if ($vars['entity'] instanceof ElggUser) {
        <?php
        /*
        original avatar method
-       <img src="<?php echo $vars['entity']->getIcon($vars['size']); ?>" border="0" <?php echo $align; ?> alt="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" title="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" <?php echo $vars['js']; ?> />
+       <img src="<?php echo elgg_format_url($vars['entity']->getIcon($vars['size'])); ?>" border="0" <?php echo $align; ?> alt="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" title="<?php echo htmlentities($vars['entity']->name, ENT_QUOTES, 'UTF-8'); ?>" <?php echo $vars['js']; ?> />
        */
 
        if (!$override) { 
index 01e4fe0e7f78dc7848bb5d7e4437961e978d6d67..1f4aad01896c888b4d0a5fb6efe37640420e491c 100644 (file)
@@ -53,7 +53,7 @@ if ($mysql_dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpa
                                $contents = file_get_contents($filename);
                                header("Content-Length: " . strlen($contents));
                        } else {
-                               mysql_query("INSERT into {$CONFIG->dbprefix}datalists set name = 'simplecache_lastupdate', value = '0' ON DUPLICATE KEY UPDATE value='0'");
+                               mysql_query("INSERT into {$CONFIG->dbprefix}datalists set name = 'simplecache_lastupdate_$viewtype', value = '0' ON DUPLICATE KEY UPDATE value='0'");
 
                                echo ''; exit;
                        }
index d659d415c9e733b5ef714ffb326ac366e57ff462..4d83658e3d9a41a97c3fd318f1939fe156b9efcb 100644 (file)
@@ -19,8 +19,7 @@ if (get_input('upgrade') == 'upgrade') {
        if (version_upgrade_check()) {
                version_upgrade();
        }
-       datalist_set('simplecache_lastupdate',0);
-
+       elgg_view_regenerate_simplecache();
        elgg_filepath_cache_reset();
 } else {
        global $CONFIG;
index bfa62f449ff2d76b1991ca496f6fcc61dd2a418e..b8d0efc3fe3af0991cee77e48b0308f0708f3b13 100644 (file)
@@ -12,7 +12,7 @@
 
 // YYYYMMDD = Elgg Date
 // XX = Interim incrementer
-$version = 2010052601;
+$version = 2010060101;
 
 // Human-friendly version name
 $release = '1.8-svn';
index fa0d2ab0c925faba2072a72c58c7ddb50549edfc..d56b009d57c2563b727643d5a5263f688978d799 100644 (file)
@@ -61,8 +61,8 @@
        </h3>
 </td>
 <td width="17px" align="right"></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14" height="14" class="more_info" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15" height="15" class="drag_handle" /></a></td>
 </tr></table>
 
 <?php
@@ -130,8 +130,8 @@ if(get_context() != "profile"){ /* on groups */
                        </h3>
                </td>
                <td width="17px" align="right"></td>
-               <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
-               <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
+               <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14" height="14" class="more_info" /></a></td>
+               <td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15" height="15" class="drag_handle" /></a></td>
                </tr></table>
                
                <?php
@@ -175,8 +175,8 @@ if(get_context() != "profile"){ /* on groups */
        </h3>
 </td>
 <td width="17px" align="right"></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14" height="14" class="more_info" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15" height="15" class="drag_handle" /></a></td>
 </tr></table>
 
 <?php
@@ -216,8 +216,8 @@ if(get_context() != "profile"){ /* on groups */
        </h3>
 </td>
 <td width="17px" align="right"></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14px" height="14px" class="more_info" /></a></td>
-<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15px" height="15px" class="drag_handle" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="14" height="14" class="more_info" /></a></td>
+<td width="17px" align="right"><a href="#"><img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" width="15" height="15" class="drag_handle" /></a></td>
 </tr></table>
 
 <?php