Просмотр исходного кода

Merge branch 'master' of https://github.com/boonex/dolphin

AntonLV 12 лет назад
Родитель
Сommit
49941f2a0f
43 измененных файлов с 495 добавлено и 412 удалено
  1. 13 119
      inc/classes/BxDolCronCmd.php
  2. 27 0
      inc/classes/BxDolCronStorage.php
  3. 1 0
      inc/classes/BxDolEmailTemplates.php
  4. 19 3
      inc/classes/BxDolImageTranscoder.php
  5. 59 3
      inc/classes/BxDolInstallerUtils.php
  6. 8 4
      inc/classes/BxDolModuleQuery.php
  7. 71 0
      inc/classes/BxDolStorage.php
  8. 2 4
      inc/classes/BxDolStorageLocal.php
  9. 29 1
      inc/classes/BxDolStorageQuery.php
  10. 1 23
      inc/profiles.inc.php
  11. 1 1
      install/classes/BxDolInstallSiteConfig.php
  12. 17 14
      install/sql/system.sql
  13. 26 2
      modules/base/general/classes/BxBaseModGeneralInstaller.php
  14. 3 8
      modules/base/text/classes/BxBaseModTextFormEntry.php
  15. 2 6
      modules/boonex/convos/install/installer.php
  16. 0 10
      modules/boonex/convos/install/sql/disable.sql
  17. 0 17
      modules/boonex/convos/install/sql/enable.sql
  18. 12 0
      modules/boonex/convos/install/sql/install.sql
  19. 8 11
      modules/boonex/convos/install/sql/uninstall.sql
  20. 10 0
      modules/boonex/english/data/langs/system.xml
  21. 52 0
      modules/boonex/membership_pricing/classes/cron.php
  22. 1 6
      modules/boonex/notes/install/installer.php
  23. 0 10
      modules/boonex/notes/install/sql/disable.sql
  24. 0 18
      modules/boonex/notes/install/sql/enable.sql
  25. 12 0
      modules/boonex/notes/install/sql/install.sql
  26. 8 16
      modules/boonex/notes/install/sql/uninstall.sql
  27. 4 5
      modules/boonex/organizations/install/installer.php
  28. 0 11
      modules/boonex/organizations/install/sql/disable.sql
  29. 0 28
      modules/boonex/organizations/install/sql/enable.sql
  30. 23 0
      modules/boonex/organizations/install/sql/install.sql
  31. 11 9
      modules/boonex/organizations/install/sql/uninstall.sql
  32. 4 5
      modules/boonex/persons/install/installer.php
  33. 0 11
      modules/boonex/persons/install/sql/disable.sql
  34. 0 28
      modules/boonex/persons/install/sql/enable.sql
  35. 23 0
      modules/boonex/persons/install/sql/install.sql
  36. 13 8
      modules/boonex/persons/install/sql/uninstall.sql
  37. 4 2
      modules/boonex/timeline/install/installer.php
  38. 1 8
      modules/boonex/timeline/install/sql/disable.sql
  39. 0 18
      modules/boonex/timeline/install/sql/enable.sql
  40. 18 0
      modules/boonex/timeline/install/sql/install.sql
  41. 9 1
      modules/boonex/timeline/install/sql/uninstall.sql
  42. 1 0
      periodic/cron.php
  43. 2 2
      studio/classes/BxDolStudioInstaller.php

+ 13 - 119
inc/classes/BxDolCronCmd.php

@@ -12,23 +12,15 @@ defined('BX_DOL') or die('hack attempt');
 // TODO: db funtions 2 class function + prepare statements
 // TODO: other refactoring
 
-bx_import('BxDolCron.php');
+bx_import('BxDolCron');
 
 class BxDolCronCmd extends BxDolCron {
 
     // - Functions -
 
     function finish() {
-        global $MODE;
-
-        if ( $MODE != "_LIVE_" ) {
-            $output = ob_get_contents();
-            ob_end_clean();
-
-            if ( $MODE == "_MAIL_" && $output) {
-                sendMail(getParam('site_email'), getParam('site_title') . ": Periodic Report", $output, 0, array(), BX_EMAIL_NOTIFY, 'text'); // TODO: email template
-            }
-        }
+        if ($output = ob_get_clean())
+            sendMail(getParam('site_email'), getParam('site_title') . ": Periodic Report", $output, 0, array(), BX_EMAIL_NOTIFY, 'text'); // TODO: email template
     }
 
     function clean_database()
@@ -39,36 +31,22 @@ class BxDolCronCmd extends BxDolCron {
         if (db_res("DELETE FROM `sys_acl_levels_members` WHERE `DateExpires` < NOW() - INTERVAL $db_clean_mem_levels DAY"))
             db_res("OPTIMIZE TABLE `sys_acl_levels_members`");
 
-        // clear from `sys_messages`
-        if (db_res("DELETE FROM `sys_messages` WHERE FIND_IN_SET('sender', `Trash`) AND FIND_IN_SET('recipient', `Trash`)"))
-            db_res("OPTIMIZE TABLE `sys_messages`");
-
-        // clear ban table
-        if (db_res("DELETE FROM `sys_admin_ban_list` WHERE `DateTime` + INTERVAL `Time` SECOND < NOW()"))
-            db_res("OPTIMIZE TABLE `sys_admin_ban_list`");
-
         //--- Clean sessions ---//
         bx_import('BxDolSession');
         $oSession = BxDolSession::getInstance();
         $iSessions = $oSession->oDb->deleteExpired();
 
-        // clean expired ip bans
-        bx_import('BxDolAdminIpBlockList');
-        $oBxDolAdminIpBlockList = new BxDolAdminIpBlockList();
-        $iIps = $oBxDolAdminIpBlockList->deleteExpired();
-
         // clean old views
-        bx_import('BxDolViews');
-        $oBxViews = new BxDolViews('', 0);
-        $iDeletedViews = $oBxViews->maintenance ();
+        bx_import('BxDolView');
+        $iDeletedViews = BxDolView::maintenance ();
 
         // clean old votes
         bx_import('BxDolVote');
         BxDolVote::maintenance();
 
         // clean comments ratings
-        bx_import('BxDolCmts');
-        BxDolCmts::maintenance();
+        //bx_import('BxDolCmts');
+        //BxDolCmts::maintenance(); // TODO: fix it
 
         // clean storage engine expired private file tokens
         bx_import('BxDolStorage');
@@ -84,14 +62,8 @@ class BxDolCronCmd extends BxDolCron {
         $iDeletedKeys = $oKey ? $oKey->prune() : 0;
 
         echo "\n- Database cleaning -\n";
-        echo "Deleted profiles: $db_clean_profiles_num\n";
-        echo "Deleted virtual kisses: $db_clean_vkiss_num\n";
-        echo "Deleted messages: $db_clean_msg_num\n";
         echo "Deleted sessions: $iSessions\n";
-        echo "Deleted records from ip block list: $iIps\n";
         echo "Deleted views: $iDeletedViews\n";
-        echo "Deleted votes: $iDeletedVotes\n";
-        echo "Deleted comment votes: $iDeletedCommentVotes\n";
         echo "Storage expired tokens: $iDeletedExpiredTokens\n";
         echo "Deleted outdated transcoded images: $iDeletedTranscodedImages\n";
         echo "Deleted expired keys: $iDeletedKeys\n";
@@ -136,101 +108,23 @@ class BxDolCronCmd extends BxDolCron {
 
     function processing() {
 
-        global $MODE;
-
-        // - Defaults -
-        $MODE   = "_MAIL_";
-        //$MODE = "_LIVE_";
-        $DAY    = "_OBEY_";
-        //$DAY  = "_FORCE_";
-        define('NON_VISUAL_PROCESSING', 'YES');
-
-
-        // - Always finish
-        set_time_limit( 36000 );
+        set_time_limit(0);
         ignore_user_abort();
 
-        // - Parameters check -
-        for ( $i = 0; strlen( $argv[$i] ); $i++ )
-        {
-            switch( $argv[$i] )
-            {
-                case "--live": $MODE = "_LIVE_"; break;
-                case "--mail": $MODE = "_MAIL_"; break;
-                case "--force-day": $DAY = "_FORCE_"; break;
-                case "--obey-day": $DAY = "_OBEY_"; break;
-            }
-        }
-
-        if ( $MODE != "_LIVE_" )
-            ob_start();
+        ob_start();
 
-        $day = date( "d" );
-        if ( getParam( "cmdDay" ) == $day && $DAY == "_OBEY_" )
-        {
+        $iDay = date( "d" );
+        if (getParam( "cmdDay" ) == $iDay) {
             echo "Already done today, bailing out\n";
             $this->finish();
             return;
         }
 
-        setParam( "cmdDay", $day );
-
-        //========================================================================================================================
-
-        // - Membership check -
-        echo "\n- Membership expiration letters -\n";
-
-        $iExpireNotificationDays = (int)getParam("expire_notification_days");
-        $bExpireNotifyOnce = getParam("expire_notify_once") == 'on';
-
-        $iExpireLetters = 0;
-
-        bx_import('BxDolDb');
-        $oDb = BxDolAcl::getInstance();
-
-        bx_import('BxDolAcl');
-        $oAcl = BxDolAcl::getInstance();
-
-        $aRow = $oDb->getFirstRow( "SELECT `ID` FROM `Profiles`");
-        while(!empty($aRow)) {
-            $aCurrentMem = getMemberMembershipInfo( $aRow['ID'] );
-            // If expire_notification_days is -1 then notify after expiration
-            if ( $aCurrentMem['ID'] == MEMBERSHIP_ID_STANDARD && $iExpireNotificationDays == -1 ) {
-                // Calculate last UNIX Timestamp
-                $iLastTimestamp = time() - 24 * 3600;
-                $aLastMem = getMemberMembershipInfo( $aRow['ID'], $iLastTimestamp );
-                if($aCurrentMem['ID'] != $aLastMem['ID']) {
-                    $bMailResult = $oAcl->getExpirationLetter($aRow['ID'], $aLastMem['Name'], -1);
-                    if($bMailResult)
-                        $iExpireLetters++;
-                }
-            }
-            // If memberhip is not standard then check if it will change
-            else if($aCurrentMem['ID'] != MEMBERSHIP_ID_STANDARD) {
-                // Calculate further UNIX Timestamp
-                $iFurtherTimestamp = time() + $iExpireNotificationDays * 24 * 3600;
-                $aFurtherMem = getMemberMembershipInfo( $aRow['ID'], $iFurtherTimestamp );
-                if($aCurrentMem['ID'] != $aFurtherMem['ID'] && $aFurtherMem['ID'] == MEMBERSHIP_ID_STANDARD) {
-                    if(!$bExpireNotifyOnce || abs($iFurtherTimestamp - $aCurrentMem['DateExpires']) < 24 * 3600) {
-                        $bMailResult = $oAcl->getExpirationLetter( $aRow['ID'], $aCurrentMem['Name'], (int)(($aCurrentMem['DateExpires'] - time())/(24 * 3600)));
-                        if($bMailResult)
-                            $iExpireLetters++;
-                    }
-                }
-            }
-
-            $aRow = $oDb->getNextRow();
-        }
-
-        echo "Send membership expire letters: $iExpireLetters letters\n";
-
-        //========================================================================================================================
-
-        // clear tmp folder --------------------------------------------------------------------------
+        setParam("cmdDay", $iDay);
 
+        // clear tmp folder 
         $this->del_old_all_files();
 
-        // ----------------------------------------------------------------------------------
         $this->clean_database();
 
         $this->finish();

+ 27 - 0
inc/classes/BxDolCronStorage.php

@@ -0,0 +1,27 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    DolphinCore Dolphin Core
+ * @{
+ */
+
+bx_import('BxDolCron');
+
+class BxDolCronStorage extends BxDolCron 
+{
+    function processing() 
+    {
+        set_time_limit(36000);
+        ignore_user_abort();
+
+        bx_import('BxDolStorage');
+        if (BxDolStorage::pruneDeletions()) { // if any files were deleted
+            bx_import('BxDolInstallerUtils');
+            BxDolInstallerUtils::checkModulesPendingUninstall(); // try to uninstall modules pending for uninstall
+        }
+    }
+}
+
+/** @} */

+ 1 - 0
inc/classes/BxDolEmailTemplates.php

@@ -178,6 +178,7 @@ class BxDolEmailTemplates extends BxDol implements iBxDolSingleton {
         if (is_array($aKeys))
             $aResultKeys = array_merge($aResultKeys, $aKeys);
 
+        bx_import('BxDolTemplate');
         return BxDolTemplate::getInstance()->parseHtmlByContent($sContent, $aResultKeys, array('{', '}'));
     }
 }

+ 19 - 3
inc/classes/BxDolImageTranscoder.php

@@ -154,7 +154,7 @@ class BxDolImageTranscoder extends BxDol implements iBxDolFactoryObject
      * @param $mixed array of transcoders objects, or just one object 
      */
     static public function registerHandlersArray ($mixed) {
-        self::_registerHandlersArray ($mixed, 'registerHandlers');
+        self::_callFuncForObjectsArray ($mixed, 'registerHandlers');
     }
 
     /**
@@ -163,7 +163,16 @@ class BxDolImageTranscoder extends BxDol implements iBxDolFactoryObject
      * @param $mixed array of transcoders objects, or just one object 
      */
     static public function unregisterHandlersArray ($mixed) {
-        self::_registerHandlersArray ($mixed, 'unregisterHandlers');
+        self::_callFuncForObjectsArray ($mixed, 'unregisterHandlers');
+    }
+
+    /**
+     * Cleanup (queue for deletion all resized files)
+     * It can be called upon module disbale event.
+     * @param $mixed array of transcoders objects, or just one object 
+     */
+    static public function cleanupObjectsArray ($mixed) {
+        self::_callFuncForObjectsArray ($mixed, 'cleanup');
     }
 
     /**
@@ -241,6 +250,13 @@ class BxDolImageTranscoder extends BxDol implements iBxDolFactoryObject
         return $this->clearCacheDB();
     }
 
+    /**
+     * Delete (queue for deletion) all resized files for the current object
+     */
+    public function cleanup () {
+        return $this->_oStorage->queueFilesForDeletionFromObject();
+    }
+
     /**
      * Get storage object where transcoded data is stored    
      */
@@ -614,7 +630,7 @@ class BxDolImageTranscoder extends BxDol implements iBxDolFactoryObject
         return '' . $mixedHandler . $this->getDevicePixelRatioHandlerSuffix ();
     }
 
-    static protected function _registerHandlersArray ($mixed, $sFunc) {
+    static protected function _callFuncForObjectsArray ($mixed, $sFunc) {
         if (!is_array($mixed))
             $mixed = array($mixed);
         foreach ($mixed as $sObject) {

+ 59 - 3
inc/classes/BxDolInstallerUtils.php

@@ -16,7 +16,7 @@ class BxDolInstallerUtils extends BxDolIO
         parent::__construct();
     }
 
-    function isXsltEnabled()
+    static public function isXsltEnabled()
     {
         if (((int)phpversion()) >= 5) {
             if (class_exists ('DOMDocument') && class_exists ('XsltProcessor'))
@@ -30,7 +30,7 @@ class BxDolInstallerUtils extends BxDolIO
         return false;
     }
 
-    function isAllowUrlInclude()
+    static public function isAllowUrlInclude()
     {
         if (version_compare(phpversion(), "5.2", ">") == 1) {
             $sAllowUrlInclude = ini_get('allow_url_include');
@@ -39,12 +39,68 @@ class BxDolInstallerUtils extends BxDolIO
         return false;
     }
 
-    function isModuleInstalled($sUri)
+    static public function isModuleInstalled($sUri)
     {
         bx_import('BxDolModuleQuery');
         return BxDolModuleQuery::getInstance()->isModule($sUri);
     }
 
+    /**
+     * Set module for delayed uninstall 
+     */
+    static public function setModulePendingUninstall($sUri, $bPendingUninstall = true)
+    {
+        bx_import('BxDolModuleQuery');
+        return BxDolModuleQuery::getInstance()->setModulePendingUninstall($sUri, $bPendingUninstall);
+    }
+
+    /**
+     * Check if module is pending for uninstall
+     */
+    static public function isModulePendingUninstall($sUri)
+    {
+        bx_import('BxDolModuleQuery');
+        $a = BxDolModuleQuery::getInstance()->getModuleByUri($sUri);
+        return $a['pending_uninstall'];
+    }
+
+    /**
+     * Check all pending for uninstallation modules and uninstall them if no pending for deletion files are found
+     */
+    static public function checkModulesPendingUninstall()
+    {
+        bx_import('BxDolModuleQuery');
+        $a = BxDolModuleQuery::getInstance()->getModules();
+        foreach ($a as $aModule) {
+
+            // after we make sure that all pending for deletion files are deleted
+            if (!$aModule['pending_uninstall'] || BxDolStorage::isQueuedFilesForDeletion($aModule['name']))
+                continue;
+
+            // remove pending uninstall flag
+            self::setModulePendingUninstall($aModule['uri'], false);
+
+            // perform uninstallation
+            bx_import('BxDolStudioInstallerUtils');
+            $aResult = BxDolStudioInstallerUtils::getInstance()->perform($aModule['path'], 'uninstall');
+
+            // send email nofitication
+            $aTemplateKeys = array(
+                'Module' => $aModule['title'],
+                'Result' => _t('_Success'),
+                'Message' => '',
+            );
+
+            if ($aResult['code'] > 0) {
+                $aTemplateKeys['Result'] = _t('_Failed');
+                $aTemplateKeys['Message'] = $aResult['message'];
+            }
+
+            bx_import('BxDolEmailTemplates');
+            $aMessage = BxDolEmailTemplates::getInstance()->parseTemplate('t_DelayedModuleUninstall', $aTemplateKeys);
+            sendMail (getParam('site_email'), $aMessage['Subject'], $aMessage['Body'], 0, array(), BX_EMAIL_SYSTEM);
+        }
+    }
 
     function addHtmlFields ($a)
     {

+ 8 - 4
inc/classes/BxDolModuleQuery.php

@@ -36,15 +36,15 @@ class BxDolModuleQuery extends BxDolDb implements iBxDolSingleton {
     }
 
     function getModuleById($iId) {
-        $sSql = $this->prepare("SELECT `id`, `name`, `title`, `vendor`, `version`, `product_url`, `update_url`, `path`, `uri`, `class_prefix`, `db_prefix`, `lang_category`, `date`, `enabled` FROM `sys_modules` WHERE `id`=? LIMIT 1", $iId);
+        $sSql = $this->prepare("SELECT * FROM `sys_modules` WHERE `id`=? LIMIT 1", $iId);
         return $this->fromMemory('sys_modules_' . $iId, 'getRow', $sSql);
     }
     function getModuleByName($sName) {
-        $sSql = $this->prepare("SELECT `id`, `name`, `title`, `vendor`, `version`, `product_url`, `update_url`, `path`, `uri`, `class_prefix`, `db_prefix`, `lang_category`, `date`, `enabled` FROM `sys_modules` WHERE `name`=? LIMIT 1", $sName);
+        $sSql = $this->prepare("SELECT * FROM `sys_modules` WHERE `name`=? LIMIT 1", $sName);
         return $this->fromMemory('sys_modules_' . $sName, 'getRow', $sSql);
     }
     function getModuleByUri($sUri) {
-        $sSql = $this->prepare("SELECT `id`, `name`, `title`, `vendor`, `version`, `product_url`, `update_url`, `path`, `uri`, `class_prefix`, `db_prefix`, `lang_category`, `date`, `enabled` FROM `sys_modules` WHERE `uri`=? LIMIT 1", $sUri);
+        $sSql = $this->prepare("SELECT * FROM `sys_modules` WHERE `uri`=? LIMIT 1", $sUri);
         return $this->fromMemory('sys_modules_' . $sUri, 'getRow', $sSql);
     }
     function enableModuleByUri($sUri) {
@@ -55,6 +55,10 @@ class BxDolModuleQuery extends BxDolDb implements iBxDolSingleton {
         $sSql = $this->prepare("UPDATE `sys_modules` SET `enabled`='0' WHERE `uri`=? LIMIT 1", $sUri);
         return (int)$this->query($sSql) > 0;
     }
+    function setModulePendingUninstall($sUri, $bPendingUninstall) {
+        $sSql = $this->prepare("UPDATE `sys_modules` SET `pending_uninstall` = ? WHERE `uri` = ? LIMIT 1", $bPendingUninstall ? 1 : 0, $sUri);
+        return $this->query($sSql);
+    }
     function isModule($sUri) {
         $sSql = $this->prepare("SELECT `id` FROM `sys_modules` WHERE `uri`=? LIMIT 1", $sUri);
         return (int)$this->getOne($sSql) > 0;
@@ -76,7 +80,7 @@ class BxDolModuleQuery extends BxDolDb implements iBxDolSingleton {
         return (int)$this->getOne($sSql) > 0;
     }
     function getModules() {
-        $sSql = "SELECT `id`, `type`, `name`, `title`, `vendor`, `version`, `product_url`, `update_url`, `path`, `uri`, `class_prefix`, `db_prefix`, `lang_category`, `date`, `enabled` FROM `sys_modules` ORDER BY `title`";
+        $sSql = "SELECT * FROM `sys_modules` ORDER BY `title`";
         return $this->fromMemory('sys_modules', 'getAll', $sSql);
     }
     function getModulesBy($aParams = array()) {

+ 71 - 0
inc/classes/BxDolStorage.php

@@ -55,6 +55,8 @@ define('BX_DOL_STORAGE_DEFAULT_MIME_TYPE', 'octet/stream'); ///< default mime ty
 
 define('BX_DOL_STORAGE_DEFAULT_ICON', 'mime-type-any.png'); ///< default icon if no other icon can be determined by file extension
 
+define('BX_DOL_STORAGE_QUEUED_DELETIONS_PER_RUN', 200); ///< max number of file deletions per one cron run, @see BxDolStorage::pruneDeletions
+
 bx_import('BxDolStorageQuery');
 
 /** 
@@ -254,6 +256,32 @@ abstract class BxDolStorage extends BxDol implements iBxDolFactoryObject {
         return $iDeleted;
     }
 
+    /**
+     * Delete files queued for deletions
+     * It is alutomatically called upin cron execution, usually one time per minute.
+     * Max number of deletetion per time is defined in @see BX_DOL_STORAGE_QUEUED_DELETIONS_PER_RUN
+     * @return number of deleted records
+     */
+    public static function pruneDeletions() {
+        $iDeleted = 0;
+        $a = BxDolStorageQuery::getQueuedFilesForDeletion(BX_DOL_STORAGE_QUEUED_DELETIONS_PER_RUN);
+        foreach ($a as $r) {
+            $o = BxDolStorage::getObjectInstance($r['object']);
+            $iDeleted += ($o && $o->deleteFile($r['file_id']) ? 1 : 0);
+        }
+
+        return $iDeleted;
+    }
+
+    /**
+     * Check if module has any files pending for deletion, it is supposed that all module storage object names are prefixed with module name
+     * @param $sPrefix - usually module name
+     * @return number of files pending for deletion which were found by prefix
+     */
+    public static function isQueuedFilesForDeletion ($sPrefix) {
+        return BxDolStorageQuery::isQueuedFilesForDeletion($sPrefix);
+    }
+
     /**
      * Is storage engine available?
      * @return boolean
@@ -523,6 +551,39 @@ abstract class BxDolStorage extends BxDol implements iBxDolFactoryObject {
         return true;
     }
 
+    /**
+     * Queue file(s) for deletion. File(s) will be deleted later upon cron call (usually every minute).
+     * @param $mixedFileId file id or array of file ids.
+     * @return number of queued files
+     */
+    public function queueFilesForDeletion($mixedFileId) {
+        if (!is_array($mixedFileId))
+            $mixedFileId = array ($mixedFileId);
+        bx_import('BxDolForm');
+        $oChecker = new BxDolFormCheckerHelper();
+        return $this->_oDb->queueFilesForDeletion (array_unique($oChecker->passInt($mixedFileId)));
+    }
+
+    /**
+     * Queue file(s) for deletion by getting neccesary files from ghosts table by profile id and content id 
+     * @param $iProfileId profile id associated with files
+     * @param $iContentId content id associated with files, or false if to check by profile id only
+     * @return number of queued files
+     */
+    public function queueFilesForDeletionFromGhosts($iProfileId, $iContentId = false) {
+        $aFiles = $this->getGhosts ($iProfileId, $iContentId);
+        return $this->queueFiles($aFiles);
+    }
+
+    /**
+     * Queue file(s) for deletion of the whole storage object
+     * @return number of queued files
+     */
+    public function queueFilesForDeletionFromObject() {
+        $aFiles = $this->getFiles (false);
+        return $this->queueFiles($aFiles);
+    }
+
     /**
      * Set file private or public.
      */
@@ -923,6 +984,16 @@ abstract class BxDolStorage extends BxDol implements iBxDolFactoryObject {
         return in_array ($sExt, $this->_aObject[$sExtMode]);
     }
 
+    protected function queueFiles($aFiles) {
+        if (!$aFiles)
+            return 0;
+
+        $a = array();
+        foreach ($aFiles as $aFile)
+            $a[] = $aFile['id'];
+
+        return $this->queueFilesForDeletion($a);
+    }
 }
 
 

+ 2 - 4
inc/classes/BxDolStorageLocal.php

@@ -109,10 +109,8 @@ class BxDolStorageLocal extends BxDolStorage {
 
         $sFileLocation = $this->getObjectBaseDir($isPrivate) . $sFilePath;
 
-        if (!file_exists($sFileLocation)) {
-            $this->setErrorCode(BX_DOL_STORAGE_ERR_FILE_NOT_FOUND);
-            return false;
-        }
+        if (!file_exists($sFileLocation))
+            return true;
 
         if (!unlink($sFileLocation)) {
             $this->setErrorCode(BX_DOL_STORAGE_ERR_UNLINK);

+ 29 - 1
inc/classes/BxDolStorageQuery.php

@@ -133,10 +133,16 @@ class BxDolStorageQuery extends BxDolDb {
 
     public function deleteFile($iFileId) {
 
+        // delete queued record for the file
+        $sQuery = $this->prepare("DELETE FROM `sys_storage_deletions` WHERE `object` = ? AND `file_id` = ?", $this->_aObject['object'], $iFileId);
+        $this->query($sQuery);
+
+        // delete file record
         $sQuery = $this->prepare("DELETE FROM " . $this->_sTableFiles . " WHERE `id` = ?", $iFileId);
         if (!$this->query($sQuery))
             return false;
 
+        // delete any file traces in ghosts table
         $sQuery = $this->prepare("DELETE FROM `sys_storage_ghosts` WHERE `object` = ? AND `id` = ?", $this->_aObject['object'], $iFileId);
         $this->query($sQuery);
 
@@ -220,7 +226,7 @@ class BxDolStorageQuery extends BxDolDb {
                 $sJoin .= $this->prepare(" AND `g`.`content_id` = ?", $iContentId);
             $sJoin .= ')';
         }
-        $sQuery = "SELECT `f`.* FROM " . $this->_sTableFiles . " AS `f` " . $sJoin . $this->prepare("WHERE `f`.`profile_id` = ?", $iProfileId);
+        $sQuery = "SELECT `f`.* FROM " . $this->_sTableFiles . " AS `f` " . $sJoin . (false === $iProfileId ? '' : $this->prepare("WHERE `f`.`profile_id` = ?", $iProfileId));
         return $this->getAll($sQuery);
     }
 
@@ -232,5 +238,27 @@ class BxDolStorageQuery extends BxDolDb {
             $this->query("OPTIMIZE TABLE `sys_storage_tokens`");
         return $iCount;
     }
+
+    public function queueFilesForDeletion ($a) {
+        $iTime = time();
+        $iAdded = 0;
+        foreach ($a as $iFileId) {
+            $sQuery = $this->prepare("INSERT IGNORE INTO `sys_storage_deletions` SET `object` = ?, `file_id` = ?, `requested` = ?", $this->_aObject['object'], (int)$iFileId, $iTime);
+            $iAdded += ($this->query($sQuery) ? 1 : 0);
+        }
+        return $iAdded;
+    }
+
+    public static function getQueuedFilesForDeletion ($iLimit = 1000) {
+        $oDb = BxDolDb::getInstance();
+        $sQuery = $oDb->prepare("SELECT `object`, `file_id` FROM `sys_storage_deletions` ORDER BY `requested` ASC LIMIT ?", $iLimit);
+        return $oDb->getAll($sQuery);
+    }
+
+    public static function isQueuedFilesForDeletion ($sPrefix) {
+        $oDb = BxDolDb::getInstance();
+        $sQuery = $oDb->prepare("SELECT COUNT(*) FROM `sys_storage_deletions` WHERE `object` LIKE ?", $sPrefix . '%');
+        return $oDb->getOne($sQuery);
+    }
 }
 

+ 1 - 23
inc/profiles.inc.php

@@ -69,22 +69,6 @@ function isRole($iRole, $iId = 0) {
     return true;
 }
 
-function isLoggedBanned($iCurUserID = 0) {
-    $iCCurUserID = ($iCurUserID>0) ? $iCurUserID : (int)$_COOKIE['memberID'];
-    if ($iCCurUserID) {
-        $CheckSQL = "
-            SELECT *
-            FROM `sys_admin_ban_list`
-            WHERE `ProfID`='{$iCCurUserID}'
-        ";
-        db_res($CheckSQL);
-        if (db_affected_rows()>0) {
-            return true;
-        }
-    }
-    return false;
-}
-
 function bx_login($iId, $bRememberMe = false) {
     bx_import('BxDolAccountQuery');
     $oAccountQuery = BxDolAccountQuery::getInstance();
@@ -173,16 +157,10 @@ function bx_check_password($sLogin, $sPassword, $iRole = BX_DOL_ROLE_MEMBER) {
     if ($sErrorMsg = bx_check_login($aAccountInfo['id'], $sPassCheck, $iRole))
         return $sErrorMsg;
 
-    // Admin can always login even if his ip is blocked
+    // Admin can always login even if he is blocked/banned/suspended/etc
     if (isAdmin($aAccountInfo['id']))
         return '';
 
-    // If account is banned
-    if (isLoggedBanned($aAccountInfo['id'])) {
-        bx_import('BxDolLanguages');
-        return _t('_member_banned');
-    }
-
     $sErrorMsg = '';
     bx_alert('account', 'check_login',  $aAccountInfo['id'], false, array('error_msg' => &$sErrorMsg));
     return $sErrorMsg;

+ 1 - 1
install/classes/BxDolInstallSiteConfig.php

@@ -405,7 +405,7 @@ EOF;
 
             foreach ($aActions as $sAction) {
                 $aResult = BxDolStudioInstallerUtils::getInstance()->perform($aConfig['home_dir'], $sAction);
-                if ((!isset($aResult['result']) || !$aResult['result']) && !empty($aResult['message']))
+                if ((!isset($aResult['code']) || $aResult['code']) && !empty($aResult['message']))
                     return _t('_sys_inst_msg_module_error', $aConfig['title'], $aResult['message']);
             }
         }

+ 17 - 14
install/sql/system.sql

@@ -7,7 +7,7 @@ SET @sSysVersion = '8.0.0';
 -- --------------------------------------------------------
 
 SET NAMES 'utf8';
-DROP TABLE IF EXISTS `sys_keys`, `sys_objects_editor`, `sys_objects_captcha`, `sys_objects_social_sharing`, `sys_objects_cmts`, `sys_cmts_images`, `sys_cmts_images_preview`, `sys_cmts_images2entries`, `sys_email_templates`, `sys_options`, sys_options_types, `sys_options_categories`, `sys_localization_categories`, `sys_localization_keys`, `sys_localization_languages`, `sys_localization_strings`, `sys_acl_actions`, `sys_acl_actions_track`, `sys_acl_matrix`, `sys_acl_levels`, `sys_sessions`, `sys_acl_levels_members`, `sys_objects_search`, `sys_stat_site`, `sys_alerts`, `sys_alerts_handlers`, `sys_injections`, `sys_injections_admin`, `sys_modules`, `sys_modules_file_tracks`, `sys_permalinks`, `sys_objects_privacy`, `sys_privacy_defaults`, `sys_privacy_groups`, `sys_objects_auths`, `sys_objects_vote`, `sys_objects_view`, `sys_cron_jobs`, `sys_objects_storage`, `sys_objects_uploader`, `sys_storage_user_quotas`, `sys_storage_tokens`, `sys_storage_ghosts`, `sys_storage_mime_types`, `sys_objects_transcoder_images`, `sys_transcoder_images_files`, `sys_transcoder_images_filters`, `sys_accounts`, `sys_profiles`, `sys_objects_form`, `sys_form_displays`, `sys_form_inputs`, `sys_form_display_inputs`, `sys_form_pre_lists`, `sys_form_pre_values`, `sys_menu_templates`, `sys_objects_menu`, `sys_menu_sets`, `sys_menu_items`, `sys_objects_grid`, `sys_grid_fields`, `sys_grid_actions`, `sys_objects_connection`, `sys_profiles_conn_subscriptions`, `sys_profiles_conn_friends`, `sys_objects_page`, `sys_pages_layouts`, `sys_pages_design_boxes`, `sys_pages_blocks`, `sys_images`, `sys_std_pages`, `sys_std_widgets`, `sys_std_pages_widgets`;
+DROP TABLE IF EXISTS `sys_keys`, `sys_objects_editor`, `sys_objects_captcha`, `sys_objects_social_sharing`, `sys_objects_cmts`, `sys_cmts_images`, `sys_cmts_images_preview`, `sys_cmts_images2entries`, `sys_email_templates`, `sys_options`, sys_options_types, `sys_options_categories`, `sys_localization_categories`, `sys_localization_keys`, `sys_localization_languages`, `sys_localization_strings`, `sys_acl_actions`, `sys_acl_actions_track`, `sys_acl_matrix`, `sys_acl_levels`, `sys_sessions`, `sys_acl_levels_members`, `sys_objects_search`, `sys_stat_site`, `sys_alerts`, `sys_alerts_handlers`, `sys_injections`, `sys_injections_admin`, `sys_modules`, `sys_modules_file_tracks`, `sys_permalinks`, `sys_objects_privacy`, `sys_privacy_defaults`, `sys_privacy_groups`, `sys_objects_auths`, `sys_objects_vote`, `sys_objects_view`, `sys_cron_jobs`, `sys_objects_storage`, `sys_objects_uploader`, `sys_storage_user_quotas`, `sys_storage_tokens`, `sys_storage_ghosts`, `sys_storage_deletions`, `sys_storage_mime_types`, `sys_objects_transcoder_images`, `sys_transcoder_images_files`, `sys_transcoder_images_filters`, `sys_accounts`, `sys_profiles`, `sys_objects_form`, `sys_form_displays`, `sys_form_inputs`, `sys_form_display_inputs`, `sys_form_pre_lists`, `sys_form_pre_values`, `sys_menu_templates`, `sys_objects_menu`, `sys_menu_sets`, `sys_menu_items`, `sys_objects_grid`, `sys_grid_fields`, `sys_grid_actions`, `sys_objects_connection`, `sys_profiles_conn_subscriptions`, `sys_profiles_conn_friends`, `sys_objects_page`, `sys_pages_layouts`, `sys_pages_design_boxes`, `sys_pages_blocks`, `sys_images`, `sys_std_pages`, `sys_std_widgets`, `sys_std_pages_widgets`;
 ALTER DATABASE DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
 
 
@@ -150,7 +150,8 @@ INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `B
 ('system', '_sys_et_txt_name_system_password_reset', 't_PasswordReset', '_sys_et_txt_subject_password_reset', '_sys_et_txt_body_password_reset'),
 ('system', '_sys_et_txt_name_system_mem_expiration', 't_MemExpiration', '_sys_et_txt_subject_mem_expiration', '_sys_et_txt_body_mem_expiration'),
 ('system', '_sys_et_txt_name_system_mem_changed', 't_MemChanged', '_sys_et_txt_subject_mem_changed', '_sys_et_txt_body_mem_changed'),
-('system', '_sys_et_txt_name_system_comment_replied', 't_CommentReplied', '_sys_et_txt_subject_comment_replied', '_sys_et_txt_body_comment_replied');
+('system', '_sys_et_txt_name_system_comment_replied', 't_CommentReplied', '_sys_et_txt_subject_comment_replied', '_sys_et_txt_body_comment_replied'),
+('system', '_sys_et_txt_name_system_delayed_module_uninstall', 't_DelayedModuleUninstall', '_sys_et_txt_subject_delayed_module_uninstall', '_sys_et_txt_body_delayed_module_uninstall');
 
 -- --------------------------------------------------------
 
@@ -728,6 +729,7 @@ CREATE TABLE `sys_modules` (
   `dependencies` varchar(255) NOT NULL default '',
   `date` int(11) unsigned NOT NULL default '0',
   `enabled` tinyint(1) NOT NULL default '0',
+  `pending_uninstall` tinyint(4) NOT NULL,
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`),
   UNIQUE KEY `path` (`path`),
@@ -959,14 +961,8 @@ INSERT INTO `sys_privacy_groups`(`id`, `title`, `check`, `active`, `visible`) VA
 ('4', '_sys_ps_group_title_members', '@members', 0, 0),
 ('5', '_sys_ps_group_title_friends', '@friends', 1, 1);
 
-
 -- --------------------------------------------------------
 
-
---
--- Table structure for table `sys_cron_jobs`
---
-
 CREATE TABLE `sys_cron_jobs` (
   `id` int(11) unsigned NOT NULL auto_increment,
   `name` varchar(128) NOT NULL default '',
@@ -977,13 +973,10 @@ CREATE TABLE `sys_cron_jobs` (
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
 
---
--- Dumping data for table `sys_cron_jobs`
---
-
 INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES
 ('cmd', '0 0 * * *', 'BxDolCronCmd', 'inc/classes/BxDolCronCmd.php', ''),
-('notifies', '*/10 * * * *', 'BxDolCronNotifies', 'inc/classes/BxDolCronNotifies.php', '');
+('notifies', '*/10 * * * *', 'BxDolCronNotifies', 'inc/classes/BxDolCronNotifies.php', ''),
+('sys_storage', '* * * * *', 'BxDolCronStorage', 'inc/classes/BxDolCronStorage.php', '');
 
 -- --------------------------------------------------------
 
@@ -1042,10 +1035,20 @@ CREATE TABLE IF NOT EXISTS `sys_storage_ghosts` (
   KEY `profile_object_content` (`profile_id`,`object`,`content_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+CREATE TABLE IF NOT EXISTS `sys_storage_deletions` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `object` varchar(64) NOT NULL,
+  `file_id` int(11) NOT NULL,
+  `requested` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `object_file_id` (`object`,`file_id`),
+  KEY `requested` (`requested`)
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
+
 CREATE TABLE IF NOT EXISTS `sys_storage_mime_types` (
   `ext` varchar(32) NOT NULL,
   `mime_type` varchar(128) NOT NULL,
-  `icon` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+  `icon` varchar(255) NOT NULL,
   PRIMARY KEY (`ext`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 

+ 26 - 2
modules/base/general/classes/BxBaseModGeneralInstaller.php

@@ -10,13 +10,15 @@
  */
 
 bx_import('BxDolStudioInstaller');
+bx_import('BxDolStorage');
 bx_import('BxDolImageTranscoder');
 bx_import('BxDolService');
 
 class BxBaseModGeneralInstaller extends BxDolStudioInstaller 
 {
-    protected $_aTranscoders = array ();
-    protected $_bUpdateTimeline = false;
+    protected $_aStorages = array (); // storage objects to automatically delete files from upon module uninstallation, don't add storage objects used in image transcoder objects
+    protected $_aTranscoders = array (); // image transcoder objects to automatically register/unregister necessary alerts for
+    protected $_bUpdateTimeline = false; // set to true to automatically register handlers for timeline module
 
     function __construct($aConfig) 
     {
@@ -44,6 +46,7 @@ class BxBaseModGeneralInstaller extends BxDolStudioInstaller
             BxDolService::call('timeline', 'delete_handlers', array($this->_aConfig['home_uri']));
 
         BxDolImageTranscoder::unregisterHandlersArray($this->_aTranscoders);
+        BxDolImageTranscoder::cleanupObjectsArray($this->_aTranscoders);
 
         $aResult = parent::disable($aParams);
 
@@ -60,6 +63,27 @@ class BxBaseModGeneralInstaller extends BxDolStudioInstaller
 
     function uninstall($aParams, $bDisable = false) 
     {
+        bx_import('BxDolInstallerUtils');
+        if (BxDolInstallerUtils::isModulePendingUninstall($this->_aConfig['home_uri']))
+        	return array(
+                'message' => _t('_adm_err_modules_pending_uninstall_already'),
+                'result' => false,
+            );
+
+        $bSetModulePendingUninstall = false;
+        foreach ($this->_aStorages as $s) {
+            if (($o = BxDolStorage::getObjectInstance($s)) && $o->queueFilesForDeletionFromObject())
+                $bSetModulePendingUninstall = true;
+        }
+
+        if ($bSetModulePendingUninstall) {
+            BxDolInstallerUtils::setModulePendingUninstall($this->_aConfig['home_uri']);
+        	return array(
+                'message' => _t('_adm_err_modules_pending_uninstall'),
+                'result' => false,
+            );
+        }
+
         return parent::uninstall($aParams, $bDisable);
     }
 }

+ 3 - 8
modules/base/text/classes/BxBaseModTextFormEntry.php

@@ -95,7 +95,7 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
         $CNF = &$this->_oModule->_oConfig->CNF;
 
         if (CHECK_ACTION_RESULT_ALLOWED === $this->_oModule->checkAllowedSetThumb()) {
-            $aThumb = bx_process_input ($_POST[$CNF['FIELD_THUMB']], BX_DATA_INT);
+            $aThumb = bx_process_input (bx_get($CNF['FIELD_THUMB']), BX_DATA_INT);
             $aValsToAdd[$CNF['FIELD_THUMB']] = 0;
             if (!empty($aThumb) && is_array($aThumb) && ($iFileThumb = array_pop($aThumb)))
                 $aValsToAdd[$CNF['FIELD_THUMB']] = $iFileThumb;
@@ -114,13 +114,8 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
 
         bx_import('BxDolStorage');
         $oStorage = BxDolStorage::getObjectInstance($CNF['OBJECT_STORAGE']);
-        if (!$oStorage)
-            return false;
-
-        $aGhostFiles = $oStorage->getGhosts (bx_get_logged_profile_id(), $iContentId);
-        if ($aGhostFiles)
-            foreach ($aGhostFiles as $aFile)
-                $this->_deleteFile($aFile['id']);
+        if ($oStorage)
+            $oStorage->queueFilesForDeletionFromGhosts($aContentInfo[$CNF['FIELD_AUTHOR']], $iContentId);
 
         // delete associated objects data
 

+ 2 - 6
modules/boonex/convos/install/installer.php

@@ -16,14 +16,10 @@ class BxCnvInstaller extends BxBaseModTextInstaller
     function __construct($aConfig) 
     {
         parent::__construct($aConfig);
+        $this->_aTranscoders = array ('bx_convos_preview');
+        $this->_aStorages = array ('bx_convos_files');
         $this->_bUpdateTimeline = false;
     }
-
-    function uninstall($aParams, $bDisable = false) 
-    {
-        // TODO: delete photo files before deleting files tables
-        return parent::uninstall($aParams, $bDisable);
-    }
 }
 
 /** @} */ 

+ 0 - 10
modules/boonex/convos/install/sql/disable.sql

@@ -6,16 +6,6 @@ DELETE FROM `sys_options` WHERE `category_id` = @iCategId;
 DELETE FROM `sys_options_categories` WHERE `type_id` = @iTypeId;
 DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 
--- STORAGES & TRANSCODERS
-DELETE FROM `sys_objects_storage` WHERE `object` = 'bx_convos_files' OR `object` = 'bx_convos_photos_resized';
-DELETE FROM `sys_storage_tokens` WHERE `object` = 'bx_convos_files' OR `object` = 'bx_convos_photos_resized';
-
-DELETE FROM `sys_objects_transcoder_images` WHERE `object` = 'bx_convos_preview';
-DELETE FROM `sys_transcoder_images_filters` WHERE `transcoder_object` = 'bx_convos_preview';
-DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` = 'bx_convos_preview';
--- TODO: delete resized photo files as well
-TRUNCATE TABLE `bx_convos_photos_resized`; 
-
 -- PAGES
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_convos';
 DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_convos' OR `object` IN('bx_convos_create_entry', 'bx_convos_view_entry', 'bx_convos_home');

+ 0 - 17
modules/boonex/convos/install/sql/enable.sql

@@ -13,23 +13,6 @@ SET @iCategId = LAST_INSERT_ID();
 INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `check`, `check_error`, `extra`, `order`) VALUES
 ('bx_convos_preview_messages_num', '3', @iCategId, '_bx_cnv_option_preview_messages_num', 'digit', '', '', '', 1);
 
--- STORAGES & TRANSCODERS
-
-SET @iTotalFilesSize = (SELECT SUM(`size`) FROM `bx_convos_files`);
-SET @iTotalFilesNum = (SELECT COUNT(*) FROM `bx_convos_files`);
-SET @iTotalResizedSize = (SELECT SUM(`size`) FROM `bx_convos_photos_resized`);
-SET @iTotalResizedNum = (SELECT COUNT(*) FROM `bx_convos_photos_resized`);
-
-INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
-('bx_convos_files', 'Local', '', 360, 2592000, 3, 'bx_convos_files', 'deny-allow', '', 'action,apk,app,bat,bin,cmd,com,command,cpl,csh,exe,gadget,inf,ins,inx,ipa,isu,job,jse,ksh,lnk,msc,msi,msp,mst,osx,out,paf,pif,prg,ps1,reg,rgs,run,sct,shb,shs,u3p,vb,vbe,vbs,vbscript,workflow,ws,wsf', 0, @iTotalFilesSize, 0, @iTotalFilesNum, 0, 0),
-('bx_convos_photos_resized', 'Local', '', 360, 2592000, 3, 'bx_convos_photos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, @iTotalResizedSize, 0, @iTotalResizedNum, 0, 0);
-
-INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES 
-('bx_convos_preview', 'bx_convos_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_convos_files";}', 'no', '1', '2592000', '0');
-
-INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES 
-('bx_convos_preview', 'Resize', 'a:4:{s:1:"w";s:3:"300";s:1:"h";s:3:"200";s:11:"crop_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
-
 -- PAGE: dash
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 

+ 12 - 0
modules/boonex/convos/install/sql/install.sql

@@ -104,6 +104,18 @@ CREATE TABLE `bx_convos_views_track` (
   KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
 );
 
+-- STORAGES & TRANSCODERS
+
+INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
+('bx_convos_files', 'Local', '', 360, 2592000, 3, 'bx_convos_files', 'deny-allow', '', 'action,apk,app,bat,bin,cmd,com,command,cpl,csh,exe,gadget,inf,ins,inx,ipa,isu,job,jse,ksh,lnk,msc,msi,msp,mst,osx,out,paf,pif,prg,ps1,reg,rgs,run,sct,shb,shs,u3p,vb,vbe,vbs,vbscript,workflow,ws,wsf', 0, 0, 0, 0, 0, 0),
+('bx_convos_photos_resized', 'Local', '', 360, 2592000, 3, 'bx_convos_photos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
+
+INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES 
+('bx_convos_preview', 'bx_convos_photos_resized', 'Storage', 'a:1:{s:6:"object";s:15:"bx_convos_files";}', 'no', '1', '2592000', '0');
+
+INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES 
+('bx_convos_preview', 'Resize', 'a:4:{s:1:"w";s:3:"300";s:1:"h";s:3:"200";s:11:"crop_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
+
 -- FORMS
 
 INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 

+ 8 - 11
modules/boonex/convos/install/sql/uninstall.sql

@@ -1,19 +1,16 @@
 
--- TABLE: entries
+-- TABLES: entries
 
-DROP TABLE IF EXISTS `bx_convos_conversations`, `bx_convos_conv2folder`, `bx_convos_folders`;
+DROP TABLE IF EXISTS `bx_convos_conversations`, `bx_convos_conv2folder`, `bx_convos_folders`, `bx_convos_files`, `bx_convos_photos_resized`, `bx_convos_cmts`, `bx_convos_views_track`;
 
--- TABLE: storages & transcoders
+-- STORAGES & TRANSCODERS
 
-DROP TABLE IF EXISTS `bx_convos_files`, `bx_convos_photos_resized`;
+DELETE FROM `sys_objects_storage` WHERE `object` = 'bx_convos_files' OR `object` = 'bx_convos_photos_resized';
+DELETE FROM `sys_storage_tokens` WHERE `object` = 'bx_convos_files' OR `object` = 'bx_convos_photos_resized';
 
--- TABLE: comments
-
-DROP TABLE IF EXISTS `bx_convos_cmts`;
-
--- TABLE: views
-
-DROP TABLE IF EXISTS `bx_convos_views_track`;
+DELETE FROM `sys_objects_transcoder_images` WHERE `object` = 'bx_convos_preview';
+DELETE FROM `sys_transcoder_images_filters` WHERE `transcoder_object` = 'bx_convos_preview';
+DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` = 'bx_convos_preview';
 
 -- FORMS
 

+ 10 - 0
modules/boonex/english/data/langs/system.xml

@@ -562,6 +562,8 @@
 	<string name="_adm_err_modules_module_not_found"><![CDATA[Module not found]]></string>
 	<string name="_adm_err_modules_module_not_installed"><![CDATA[Module not installed]]></string>
 	<string name="_adm_err_modules_module_was_modified"><![CDATA[Module was modified]]></string>
+	<string name="_adm_err_modules_pending_uninstall"><![CDATA[Module uninstall was postponed. Module will be uninstalled automatically after all its files are deleted.]]></string>
+	<string name="_adm_err_modules_pending_uninstall_already"><![CDATA[Module is pending uninstall already.]]></string>
 	<string name="_adm_err_modules_process_action_failed"><![CDATA[An error occured. Contact with module's vendor]]></string>
 	<string name="_adm_err_modules_wrong_dependency_disable"><![CDATA[Failed to disable. The module has the following dependent modules. You need to disable them first.]]></string>
 	<string name="_adm_err_modules_wrong_dependency_install"><![CDATA[The following modules should be installed first:]]></string>
@@ -806,6 +808,7 @@
 	<string name="_adm_mobile_page_profile"><![CDATA[Profile]]></string>
     <string name="_adm_mod_cnf_uninstall"><![CDATA[<h3>Uninstall "{0}" module?</h3><p>Uninstalling "{0}" module will also delete all of its data. Do you want to continue?</p>]]></string>
 	<string name="_adm_mod_err_cannot_process_action"><![CDATA[Cannot process action. It does not have an associated handler.]]></string>
+    <string name="_adm_mod_err_only_admin_can_perform_operations_with_modules"><![CDATA[Only admin can perform operations with modules]]></string>
 	<string name="_adm_mod_err_process_operation_failed"><![CDATA[Cannot {0} module from "{1}" directory]]></string>
 	<string name="_adm_msg_modules_success_added_to_cart"><![CDATA[The product was successfully added to shopping cart.]]></string>
 	<string name="_adm_msg_modules_success_checkouted"><![CDATA[The payment was successfully accepted and should be processed automatically in a few minutes. Then the purchased product(s) will be available in Store -> Purchases.<br />Note. If it doesn't happen for some reason, you need to contact with product's vendor and provide him with your payment's details. He'll be able to process payment manually if the payment was received.]]></string>
@@ -1432,6 +1435,11 @@ If it is not enabled then please consider implement this optimization, since it
 <p>Please, click email confirmation link:</p>
 <p><a href="{conf_link}">{conf_link}</a></p>
 <p>Thank you.</p>
+<bx_include_auto:_email_footer.html />]]></string>
+	<string name="_sys_et_txt_body_delayed_module_uninstall"><![CDATA[<bx_include_auto:_email_header.html />
+<p>Module: <b>{Module}</b></p>
+<p>Uninstaltion result: {Result}</p>
+<p>{Message}</p>
 <bx_include_auto:_email_footer.html />]]></string>
 	<string name="_sys_et_txt_body_forgot"><![CDATA[<bx_include_auto:_email_header.html />
 <p>Hello!</p>
@@ -1458,6 +1466,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_et_txt_name_system_admin_email"><![CDATA[Message sending from the Admin Panel]]></string>
 	<string name="_sys_et_txt_name_system_comment_replied"><![CDATA[The letter is sent to members whose comment was replied]]></string>
 	<string name="_sys_et_txt_name_system_confirmation"><![CDATA[Profile e-mail confirmation message]]></string>
+	<string name="_sys_et_txt_name_system_delayed_module_uninstall"><![CDATA[Delayed module uninstall notification]]></string>
 	<string name="_sys_et_txt_name_system_forgot"><![CDATA[Reset password message]]></string>
 	<string name="_sys_et_txt_name_system_mem_changed"><![CDATA[The letter is sent to members whose membership level was changed]]></string>
 	<string name="_sys_et_txt_name_system_mem_expiration"><![CDATA[Membership expiration letter sent to members whose membership level expires]]></string>
@@ -1466,6 +1475,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_et_txt_subject_admin_email"><![CDATA[Message from <SiteName> Admin: <MessageSubject>]]></string>
 	<string name="_sys_et_txt_subject_comment_replied"><![CDATA[Your comment was replied]]></string>
 	<string name="_sys_et_txt_subject_confirmation"><![CDATA[Confirm Your Email (ACTION REQUIRED)]]></string>
+	<string name="_sys_et_txt_subject_delayed_module_uninstall"><![CDATA[Delayed {Module} module uninstall: {Result}]]></string>
 	<string name="_sys_et_txt_subject_forgot"><![CDATA[Reset Your Password]]></string>
 	<string name="_sys_et_txt_subject_mem_changed"><![CDATA[Your membership level was changed]]></string>
 	<string name="_sys_et_txt_subject_mem_expiration"><![CDATA[Your membership is about to expire]]></string>

+ 52 - 0
modules/boonex/membership_pricing/classes/cron.php

@@ -0,0 +1,52 @@
+<?php
+
+        //========================================================================================================================
+
+        // - Membership check -
+        echo "\n- Membership expiration letters -\n";
+
+        $iExpireNotificationDays = (int)getParam("expire_notification_days");
+        $bExpireNotifyOnce = getParam("expire_notify_once") == 'on';
+
+        $iExpireLetters = 0;
+
+        bx_import('BxDolDb');
+        $oDb = BxDolDb::getInstance();
+
+        bx_import('BxDolAcl');
+        $oAcl = BxDolAcl::getInstance();
+
+        $aRow = $oDb->getFirstRow( "SELECT `ID` FROM `Profiles`");
+        while(!empty($aRow)) {
+            $aCurrentMem = getMemberMembershipInfo( $aRow['ID'] );
+            // If expire_notification_days is -1 then notify after expiration
+            if ( $aCurrentMem['ID'] == MEMBERSHIP_ID_STANDARD && $iExpireNotificationDays == -1 ) {
+                // Calculate last UNIX Timestamp
+                $iLastTimestamp = time() - 24 * 3600;
+                $aLastMem = getMemberMembershipInfo( $aRow['ID'], $iLastTimestamp );
+                if($aCurrentMem['ID'] != $aLastMem['ID']) {
+                    $bMailResult = $oAcl->getExpirationLetter($aRow['ID'], $aLastMem['Name'], -1);
+                    if($bMailResult)
+                        $iExpireLetters++;
+                }
+            }
+            // If memberhip is not standard then check if it will change
+            else if($aCurrentMem['ID'] != MEMBERSHIP_ID_STANDARD) {
+                // Calculate further UNIX Timestamp
+                $iFurtherTimestamp = time() + $iExpireNotificationDays * 24 * 3600;
+                $aFurtherMem = getMemberMembershipInfo( $aRow['ID'], $iFurtherTimestamp );
+                if($aCurrentMem['ID'] != $aFurtherMem['ID'] && $aFurtherMem['ID'] == MEMBERSHIP_ID_STANDARD) {
+                    if(!$bExpireNotifyOnce || abs($iFurtherTimestamp - $aCurrentMem['DateExpires']) < 24 * 3600) {
+                        $bMailResult = $oAcl->getExpirationLetter( $aRow['ID'], $aCurrentMem['Name'], (int)(($aCurrentMem['DateExpires'] - time())/(24 * 3600)));
+                        if($bMailResult)
+                            $iExpireLetters++;
+                    }
+                }
+            }
+
+            $aRow = $oDb->getNextRow();
+        }
+
+        echo "Send membership expire letters: $iExpireLetters letters\n";
+
+

+ 1 - 6
modules/boonex/notes/install/installer.php

@@ -17,12 +17,7 @@ class BxNotesInstaller extends BxBaseModTextInstaller
     {
         parent::__construct($aConfig);
         $this->_aTranscoders = array ('bx_notes_preview');
-    }
-
-    function uninstall($aParams, $bDisable = false) 
-    {
-        // -- TODO: delete photo files before deleting files tables
-        return parent::uninstall($aParams, $bDisable);
+        $this->_aStorages = array ('bx_notes_files');
     }
 }
 

+ 0 - 10
modules/boonex/notes/install/sql/disable.sql

@@ -6,16 +6,6 @@ DELETE FROM `sys_options` WHERE `category_id` = @iCategId;
 DELETE FROM `sys_options_categories` WHERE `type_id` = @iTypeId;
 DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 
--- STORAGES & TRANSCODERS
-DELETE FROM `sys_objects_storage` WHERE `object` = 'bx_notes_files' OR `object` = 'bx_notes_photos_resized';
-DELETE FROM `sys_storage_tokens` WHERE `object` = 'bx_notes_files' OR `object` = 'bx_notes_photos_resized';
-
-DELETE FROM `sys_objects_transcoder_images` WHERE `object` = 'bx_notes_preview';
-DELETE FROM `sys_transcoder_images_filters` WHERE `transcoder_object` = 'bx_notes_preview';
-DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` = 'bx_notes_preview';
--- TODO: delete resized photo files as well
-TRUNCATE TABLE `bx_notes_photos_resized`; 
-
 -- PAGES
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_notes';
 DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_notes' OR `object` IN('bx_notes_create_entry', 'bx_notes_edit_entry', 'bx_notes_delete_entry', 'bx_notes_view_entry', 'bx_notes_view_entry_comments', 'bx_notes_home', 'bx_notes_featured', 'bx_notes_author');

+ 0 - 18
modules/boonex/notes/install/sql/enable.sql

@@ -16,24 +16,6 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `c
 ('bx_notes_per_page_browse', '12', @iCategId, '_bx_notes_option_per_page_browse', 'digit', '', '', '', 10),
 ('bx_notes_rss_num', '10', @iCategId, '_bx_notes_option_rss_num', 'digit', '', '', '', 20);
 
--- STORAGES & TRANSCODERS
-
-SET @iTotalFilesSize = (SELECT SUM(`size`) FROM `bx_notes_files`);
-SET @iTotalFilesNum = (SELECT COUNT(*) FROM `bx_notes_files`);
-SET @iTotalResizedSize = (SELECT SUM(`size`) FROM `bx_notes_photos_resized`);
-SET @iTotalResizedNum = (SELECT COUNT(*) FROM `bx_notes_photos_resized`);
-
-INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
-('bx_notes_files', 'Local', '', 360, 2592000, 3, 'bx_notes_files', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, @iTotalFilesSize, 0, @iTotalFilesNum, 0, 0),
-('bx_notes_photos_resized', 'Local', '', 360, 2592000, 3, 'bx_notes_photos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, @iTotalResizedSize, 0, @iTotalResizedNum, 0, 0);
-
-INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES 
-('bx_notes_preview', 'bx_notes_photos_resized', 'Storage', 'a:1:{s:6:"object";s:14:"bx_notes_files";}', 'no', '1', '2592000', '0');
-
-INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES 
-('bx_notes_preview', 'Resize', 'a:4:{s:1:"w";s:3:"300";s:1:"h";s:3:"200";s:11:"crop_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
-
-
 -- PAGE: create entry
 
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 

+ 12 - 0
modules/boonex/notes/install/sql/install.sql

@@ -98,6 +98,18 @@ CREATE TABLE `bx_notes_views_track` (
   KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+-- STORAGES & TRANSCODERS
+
+INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
+('bx_notes_files', 'Local', '', 360, 2592000, 3, 'bx_notes_files', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
+('bx_notes_photos_resized', 'Local', '', 360, 2592000, 3, 'bx_notes_photos_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
+
+INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES 
+('bx_notes_preview', 'bx_notes_photos_resized', 'Storage', 'a:1:{s:6:"object";s:14:"bx_notes_files";}', 'no', '1', '2592000', '0');
+
+INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES 
+('bx_notes_preview', 'Resize', 'a:4:{s:1:"w";s:3:"300";s:1:"h";s:3:"200";s:11:"crop_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
+
 -- FORMS
 
 INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 

+ 8 - 16
modules/boonex/notes/install/sql/uninstall.sql

@@ -1,24 +1,16 @@
 
--- TABLE: entries
+-- TABLES
 
-DROP TABLE IF EXISTS `bx_notes_posts`;
+DROP TABLE IF EXISTS `bx_notes_posts`, `bx_notes_files`, `bx_notes_photos_resized`, `bx_notes_cmts`, `bx_notes_votes`, `bx_notes_votes_track`, `bx_notes_views_track`;
 
--- TABLE: storages & transcoders
+-- STORAGES & TRANSCODERS
 
-DROP TABLE IF EXISTS `bx_notes_files`, `bx_notes_photos_resized`;
+DELETE FROM `sys_objects_storage` WHERE `object` = 'bx_notes_files' OR `object` = 'bx_notes_photos_resized';
+DELETE FROM `sys_storage_tokens` WHERE `object` = 'bx_notes_files' OR `object` = 'bx_notes_photos_resized';
 
--- TABLE: comments
-
-DROP TABLE IF EXISTS `bx_notes_cmts`;
-
--- TABLE: votes
-
-DROP TABLE IF EXISTS `bx_notes_votes`;
-DROP TABLE IF EXISTS `bx_notes_votes_track`;
-
--- TABLE: views
-
-DROP TABLE IF EXISTS `bx_notes_views_track`;
+DELETE FROM `sys_objects_transcoder_images` WHERE `object` = 'bx_notes_preview';
+DELETE FROM `sys_transcoder_images_filters` WHERE `transcoder_object` = 'bx_notes_preview';
+DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` = 'bx_notes_preview';
 
 -- FORMS
 

+ 4 - 5
modules/boonex/organizations/install/installer.php

@@ -9,16 +9,15 @@
  * @{
  */
 
-bx_import('BxDolStudioInstaller');
-bx_import('BxDolImageTranscoder');
+bx_import('BxBaseModProfileInstaller');
 
-class BxOrgsInstaller extends BxDolStudioInstaller 
+class BxOrgsInstaller extends BxBaseModProfileInstaller 
 {
-    protected $_aTranscoders = array ('bx_organizations_thumb', 'bx_organizations_avatar');
-
     function __construct($aConfig) 
     {
         parent::__construct($aConfig);
+        $this->_aTranscoders = array ('bx_organizations_icon', 'bx_organizations_thumb', 'bx_organizations_avatar', 'bx_organizations_picture', 'bx_organizations_cover', 'bx_organizations_cover_thumb');
+        $this->_aStorages = array ('bx_organizations_pics');
     }
 }
 

+ 0 - 11
modules/boonex/organizations/install/sql/disable.sql

@@ -7,17 +7,6 @@ DELETE FROM `sys_options` WHERE `category_id` = @iCategId;
 DELETE FROM `sys_options_categories` WHERE `type_id` = @iTypeId;
 DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 
--- STORAGES & TRANSCODERS
-
-DELETE FROM `sys_objects_storage` WHERE `object` IN('bx_organizations_pics', 'bx_organizations_pics_resized');
-DELETE FROM `sys_storage_tokens` WHERE `object` IN('bx_organizations_pics', 'bx_organizations_pics_resized');
-
-DELETE FROM `sys_objects_transcoder_images` WHERE `object` IN('bx_organizations_icon', 'bx_organizations_thumb', 'bx_organizations_avatar', 'bx_organizations_picture', 'bx_organizations_cover', 'bx_organizations_cover_thumb');
-DELETE FROM `sys_transcoder_images_filters` WHERE `transcoder_object` IN('bx_organizations_icon', 'bx_organizations_thumb', 'bx_organizations_avatar', 'bx_organizations_picture', 'bx_organizations_cover', 'bx_organizations_cover_thumb');
-DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` IN('bx_organizations_icon', 'bx_organizations_thumb', 'bx_organizations_avatar', 'bx_organizations_picture', 'bx_organizations_cover', 'bx_organizations_cover_thumb');
--- TODO: delete resized picture files as well
-TRUNCATE TABLE `bx_organizations_pics_resized`; 
-
 -- PAGES
 
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_organizations';

+ 0 - 28
modules/boonex/organizations/install/sql/enable.sql

@@ -16,34 +16,6 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `e
 ('bx_organizations_num_connections_quick', '4', @iCategId, '_bx_orgs_option_num_connections_quick', 'digit', '', '', '', 10),
 ('bx_organizations_num_rss', '10', @iCategId, '_bx_orgs_option_num_rss', 'digit', '', '', '', 12);
 
--- STORAGES & TRANSCODERS
-
-SET @iTotalPicturesSize = IFNULL((SELECT SUM(`size`) FROM `bx_organizations_pics`), 0);
-SET @iTotalPicturesNum = IFNULL((SELECT COUNT(*) FROM `bx_organizations_pics`), 0);
-
-SET @iTotalPicturesResizedSize = IFNULL((SELECT SUM(`size`) FROM `bx_organizations_pics_resized`), 0);
-SET @iTotalPicturesResizedNum = IFNULL((SELECT COUNT(*) FROM `bx_organizations_pics_resized`), 0);
-
-INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
-('bx_organizations_pics', 'Local', '', 360, 2592000, 3, 'bx_organizations_pics', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, @iTotalPicturesSize, 0, @iTotalPicturesNum, 0, 0),
-('bx_organizations_pics_resized', 'Local', '', 360, 2592000, 3, 'bx_organizations_pics_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, @iTotalPicturesResizedSize, 0, @iTotalPicturesResizedNum, 0, 0);
-
-INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES 
-('bx_organizations_icon', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
-('bx_organizations_thumb', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
-('bx_organizations_avatar', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
-('bx_organizations_picture', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
-('bx_organizations_cover', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
-('bx_organizations_cover_thumb', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0');
-
-INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES 
-('bx_organizations_icon', 'Resize', 'a:4:{s:1:"w";s:2:"32";s:1:"h";s:2:"32";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_organizations_thumb', 'Resize', 'a:4:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_organizations_avatar', 'Resize', 'a:4:{s:1:"w";s:2:"96";s:1:"h";s:2:"96";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_organizations_picture', 'Resize', 'a:4:{s:1:"w";s:4:"1024";s:1:"h";s:4:"1024";s:13:"square_resize";s:1:"0";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_organizations_cover', 'Resize', 'a:4:{s:1:"w";s:4:"1024";s:1:"h";s:4:"1024";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_organizations_cover_thumb', 'Resize', 'a:4:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
-
 -- PAGES
 
 -- PAGE: create profile

+ 23 - 0
modules/boonex/organizations/install/sql/install.sql

@@ -55,7 +55,30 @@ CREATE TABLE `bx_organizations_views_track` (
   KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+-- STORAGES & TRANSCODERS
+
+INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
+('bx_organizations_pics', 'Local', '', 360, 2592000, 3, 'bx_organizations_pics', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
+('bx_organizations_pics_resized', 'Local', '', 360, 2592000, 3, 'bx_organizations_pics_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
+
+INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES 
+('bx_organizations_icon', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
+('bx_organizations_thumb', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
+('bx_organizations_avatar', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
+('bx_organizations_picture', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
+('bx_organizations_cover', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0'),
+('bx_organizations_cover_thumb', 'bx_organizations_pics_resized', 'Storage', 'a:1:{s:6:"object";s:21:"bx_organizations_pics";}', 'no', '1', '2592000', '0');
+
+INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES 
+('bx_organizations_icon', 'Resize', 'a:4:{s:1:"w";s:2:"32";s:1:"h";s:2:"32";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_organizations_thumb', 'Resize', 'a:4:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_organizations_avatar', 'Resize', 'a:4:{s:1:"w";s:2:"96";s:1:"h";s:2:"96";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_organizations_picture', 'Resize', 'a:4:{s:1:"w";s:4:"1024";s:1:"h";s:4:"1024";s:13:"square_resize";s:1:"0";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_organizations_cover', 'Resize', 'a:4:{s:1:"w";s:4:"1024";s:1:"h";s:4:"1024";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_organizations_cover_thumb', 'Resize', 'a:4:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
+
 -- FORMS
+
 INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_organization', 'bx_organizations', '_bx_orgs_form_profile', '', 'a:1:{s:7:\"enctype\";s:19:\"multipart/form-data\";}', 'bx_organizations_data', 'id', '', '', 'do_submit', '', 0, 1, 'BxOrgsFormEntry', 'modules/boonex/organizations/classes/BxOrgsFormEntry.php');
 

+ 11 - 9
modules/boonex/organizations/install/sql/uninstall.sql

@@ -1,18 +1,20 @@
 
--- TABLE: PROFILES 
+-- TABLES
 
-DROP TABLE IF EXISTS `bx_organizations_data`;
-DELETE FROM sys_profiles WHERE `type` = 'bx_organizations';
+DROP TABLE IF EXISTS `bx_organizations_data`, `bx_organizations_pics`, `bx_organizations_pics_resized`, `bx_organizations_views_track`;
+
+-- PROFILES
 
--- TABLE: STORAGES & TRANSCODERS
+DELETE FROM sys_profiles WHERE `type` = 'bx_organizations';
 
--- TODO: delete picture files as well
-DROP TABLE IF EXISTS `bx_organizations_pics`; 
-DROP TABLE IF EXISTS `bx_organizations_pics_resized`;
+-- STORAGES & TRANSCODERS
 
--- TABLE: VIEWS
+DELETE FROM `sys_objects_storage` WHERE `object` IN('bx_organizations_pics', 'bx_organizations_pics_resized');
+DELETE FROM `sys_storage_tokens` WHERE `object` IN('bx_organizations_pics', 'bx_organizations_pics_resized');
 
-DROP TABLE IF EXISTS `bx_organizations_views_track`;
+DELETE FROM `sys_objects_transcoder_images` WHERE `object` IN('bx_organizations_icon', 'bx_organizations_thumb', 'bx_organizations_avatar', 'bx_organizations_picture', 'bx_organizations_cover', 'bx_organizations_cover_thumb');
+DELETE FROM `sys_transcoder_images_filters` WHERE `transcoder_object` IN('bx_organizations_icon', 'bx_organizations_thumb', 'bx_organizations_avatar', 'bx_organizations_picture', 'bx_organizations_cover', 'bx_organizations_cover_thumb');
+DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` IN('bx_organizations_icon', 'bx_organizations_thumb', 'bx_organizations_avatar', 'bx_organizations_picture', 'bx_organizations_cover', 'bx_organizations_cover_thumb');
 
 -- FORMS
 

+ 4 - 5
modules/boonex/persons/install/installer.php

@@ -9,16 +9,15 @@
  * @{
  */
 
-bx_import('BxDolStudioInstaller');
-bx_import('BxDolImageTranscoder');
+bx_import('BxBaseModProfileInstaller');
 
-class BxPersonsInstaller extends BxDolStudioInstaller 
+class BxPersonsInstaller extends BxBaseModProfileInstaller 
 {
-    protected $_aTranscoders = array ('bx_persons_thumb', 'bx_persons_avatar');
-
     function __construct($aConfig) 
     {
         parent::__construct($aConfig);
+        $this->_aTranscoders = array ('bx_persons_icon', 'bx_persons_thumb', 'bx_persons_avatar', 'bx_persons_picture', 'bx_persons_cover', 'bx_persons_cover_thumb');
+        $this->_aStorages = array ('bx_persons_pictures');
     }
 }
 

+ 0 - 11
modules/boonex/persons/install/sql/disable.sql

@@ -7,17 +7,6 @@ DELETE FROM `sys_options` WHERE `category_id` = @iCategId;
 DELETE FROM `sys_options_categories` WHERE `type_id` = @iTypeId;
 DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 
--- STORAGES & TRANSCODERS
-
-DELETE FROM `sys_objects_storage` WHERE `object` IN('bx_persons_pictures', 'bx_persons_pictures_resized');
-DELETE FROM `sys_storage_tokens` WHERE `object` IN('bx_persons_pictures', 'bx_persons_pictures_resized');
-
-DELETE FROM `sys_objects_transcoder_images` WHERE `object` IN('bx_persons_icon', 'bx_persons_thumb', 'bx_persons_avatar', 'bx_persons_picture', 'bx_persons_cover', 'bx_persons_cover_thumb');
-DELETE FROM `sys_transcoder_images_filters` WHERE `transcoder_object` IN('bx_persons_icon', 'bx_persons_thumb', 'bx_persons_avatar', 'bx_persons_picture', 'bx_persons_cover', 'bx_persons_cover_thumb');
-DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` IN('bx_persons_icon', 'bx_persons_thumb', 'bx_persons_avatar', 'bx_persons_picture', 'bx_persons_cover', 'bx_persons_cover_thumb');
--- TODO: delete resized picture files as well
-TRUNCATE TABLE `bx_persons_pictures_resized`; 
-
 -- PAGES
 
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_persons';

+ 0 - 28
modules/boonex/persons/install/sql/enable.sql

@@ -16,34 +16,6 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `e
 ('bx_persons_num_connections_quick', '4', @iCategId, '_bx_persons_option_num_connections_quick', 'digit', '', '', '', 10),
 ('bx_persons_num_rss', '10', @iCategId, '_bx_persons_option_num_rss', 'digit', '', '', '', 12);
 
--- STORAGES & TRANSCODERS
-
-SET @iTotalPicturesSize = IFNULL((SELECT SUM(`size`) FROM `bx_persons_pictures`), 0);
-SET @iTotalPicturesNum = IFNULL((SELECT COUNT(*) FROM `bx_persons_pictures`), 0);
-
-SET @iTotalPicturesResizedSize = IFNULL((SELECT SUM(`size`) FROM `bx_persons_pictures_resized`), 0);
-SET @iTotalPicturesResizedNum = IFNULL((SELECT COUNT(*) FROM `bx_persons_pictures_resized`), 0);
-
-INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
-('bx_persons_pictures', 'Local', '', 360, 2592000, 3, 'bx_persons_pictures', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, @iTotalPicturesSize, 0, @iTotalPicturesNum, 0, 0),
-('bx_persons_pictures_resized', 'Local', '', 360, 2592000, 3, 'bx_persons_pictures_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, @iTotalPicturesResizedSize, 0, @iTotalPicturesResizedNum, 0, 0);
-
-INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES 
-('bx_persons_icon', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
-('bx_persons_thumb', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
-('bx_persons_avatar', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
-('bx_persons_picture', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
-('bx_persons_cover', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
-('bx_persons_cover_thumb', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0');
-
-INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES 
-('bx_persons_icon', 'Resize', 'a:4:{s:1:"w";s:2:"32";s:1:"h";s:2:"32";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_persons_thumb', 'Resize', 'a:4:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_persons_avatar', 'Resize', 'a:4:{s:1:"w";s:2:"96";s:1:"h";s:2:"96";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_persons_picture', 'Resize', 'a:4:{s:1:"w";s:4:"1024";s:1:"h";s:4:"1024";s:13:"square_resize";s:1:"0";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_persons_cover', 'Resize', 'a:4:{s:1:"w";s:4:"1024";s:1:"h";s:4:"1024";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_persons_cover_thumb', 'Resize', 'a:4:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
-
 -- PAGES
 
 -- PAGE: create profile

+ 23 - 0
modules/boonex/persons/install/sql/install.sql

@@ -55,7 +55,30 @@ CREATE TABLE `bx_persons_views_track` (
   KEY `id` (`object_id`,`viewer_id`,`viewer_nip`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+-- STORAGES & TRANSCODERS
+
+INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
+('bx_persons_pictures', 'Local', '', 360, 2592000, 3, 'bx_persons_pictures', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
+('bx_persons_pictures_resized', 'Local', '', 360, 2592000, 3, 'bx_persons_pictures_resized', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
+
+INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES 
+('bx_persons_icon', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
+('bx_persons_thumb', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
+('bx_persons_avatar', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
+('bx_persons_picture', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
+('bx_persons_cover', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0'),
+('bx_persons_cover_thumb', 'bx_persons_pictures_resized', 'Storage', 'a:1:{s:6:"object";s:19:"bx_persons_pictures";}', 'no', '1', '2592000', '0');
+
+INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES 
+('bx_persons_icon', 'Resize', 'a:4:{s:1:"w";s:2:"32";s:1:"h";s:2:"32";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_persons_thumb', 'Resize', 'a:4:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_persons_avatar', 'Resize', 'a:4:{s:1:"w";s:2:"96";s:1:"h";s:2:"96";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_persons_picture', 'Resize', 'a:4:{s:1:"w";s:4:"1024";s:1:"h";s:4:"1024";s:13:"square_resize";s:1:"0";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_persons_cover', 'Resize', 'a:4:{s:1:"w";s:4:"1024";s:1:"h";s:4:"1024";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_persons_cover_thumb', 'Resize', 'a:4:{s:1:"w";s:2:"48";s:1:"h";s:2:"48";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
+
 -- FORMS
+
 INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_person', 'bx_persons', '_bx_persons_form_profile', '', 'a:1:{s:7:\"enctype\";s:19:\"multipart/form-data\";}', 'bx_persons_data', 'id', '', '', 'do_submit', '', 0, 1, 'BxPersonsFormEntry', 'modules/boonex/persons/classes/BxPersonsFormEntry.php');
 

+ 13 - 8
modules/boonex/persons/install/sql/uninstall.sql

@@ -1,18 +1,23 @@
 
--- TABLE: PROFILES 
-DROP TABLE IF EXISTS `bx_persons_data`;
+-- TABLES
+
+DROP TABLE IF EXISTS `bx_persons_data`,`bx_persons_pictures`, `bx_persons_pictures_resized`, `bx_persons_views_track`;
+
+-- PROFILES
+
 DELETE FROM sys_profiles WHERE `type` = 'bx_persons';
 
--- TABLE: STORAGES & TRANSCODERS
+-- STORAGES & TRANSCODERS
 
--- TODO: delete picture files as well
-DROP TABLE IF EXISTS `bx_persons_pictures`; 
-DROP TABLE IF EXISTS `bx_persons_pictures_resized`;
+DELETE FROM `sys_objects_storage` WHERE `object` IN('bx_persons_pictures', 'bx_persons_pictures_resized');
+DELETE FROM `sys_storage_tokens` WHERE `object` IN('bx_persons_pictures', 'bx_persons_pictures_resized');
 
--- TABLE: VIEWS
-DROP TABLE IF EXISTS `bx_persons_views_track`;
+DELETE FROM `sys_objects_transcoder_images` WHERE `object` IN('bx_persons_icon', 'bx_persons_thumb', 'bx_persons_avatar', 'bx_persons_picture', 'bx_persons_cover', 'bx_persons_cover_thumb');
+DELETE FROM `sys_transcoder_images_filters` WHERE `transcoder_object` IN('bx_persons_icon', 'bx_persons_thumb', 'bx_persons_avatar', 'bx_persons_picture', 'bx_persons_cover', 'bx_persons_cover_thumb');
+DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` IN('bx_persons_icon', 'bx_persons_thumb', 'bx_persons_avatar', 'bx_persons_picture', 'bx_persons_cover', 'bx_persons_cover_thumb');
 
 -- FORMS
+
 DELETE FROM `sys_objects_form` WHERE `module` = 'bx_persons';
 
 DELETE FROM `sys_form_displays` WHERE `module` = 'bx_persons';

+ 4 - 2
modules/boonex/timeline/install/installer.php

@@ -9,12 +9,14 @@
  * @{
  */
 
-bx_import('BxDolStudioInstaller');
+bx_import('BxBaseModGeneralInstaller');
 
-class BxTimelineInstaller extends BxDolStudioInstaller
+class BxTimelineInstaller extends BxBaseModGeneralInstaller
 {
 	function __construct($aConfig) {
         parent::__construct($aConfig);
+        $this->_aTranscoders = array ('bx_timeline_photos_preview', 'bx_timeline_photos_view');
+        $this->_aStorages = array ('bx_timeline_photos');
     }
 
     function enable($aParams)

+ 1 - 8
modules/boonex/timeline/install/sql/disable.sql

@@ -17,13 +17,6 @@ DELETE FROM `sys_options_categories` WHERE `type_id` = @iTypeId;
 DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 
 
--- UPLOADERS
-DELETE FROM `sys_objects_uploader` WHERE `object` = 'bx_timeline_simple';
-DELETE FROM `sys_objects_storage` WHERE `object` IN ('bx_timeline_photos', 'bx_timeline_photos_preview', 'bx_timeline_photos_view');
-DELETE FROM `sys_objects_transcoder_images` WHERE `object` IN ('bx_timeline_photos_preview', 'bx_timeline_photos_view');
-DELETE FROM `sys_transcoder_images_filters` WHERE `transcoder_object` IN ('bx_timeline_photos_preview', 'bx_timeline_photos_view');
-
-
 -- ACL
 DELETE `sys_acl_actions`, `sys_acl_matrix` FROM `sys_acl_actions`, `sys_acl_matrix` WHERE `sys_acl_matrix`.`IDAction` = `sys_acl_actions`.`ID` AND `sys_acl_actions`.`Module` = 'bx_timeline';
 DELETE FROM `sys_acl_actions` WHERE `Module` = 'bx_timeline';
@@ -39,4 +32,4 @@ DELETE FROM `sys_objects_cmts` WHERE `Name`='bx_timeline' LIMIT 1;
 
 
 -- VOTES
-DELETE FROM `sys_objects_vote` WHERE `Name`='bx_timeline' LIMIT 1;
+DELETE FROM `sys_objects_vote` WHERE `Name`='bx_timeline' LIMIT 1;

+ 0 - 18
modules/boonex/timeline/install/sql/enable.sql

@@ -65,24 +65,6 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `c
 ('bx_timeline_chars_display_max', '300', @iCategId, '_bx_timeline_option_chars_display_max', 'digit', 'GreaterThen', 'a:1:{s:3:"min";i:150;}', '_bx_timeline_option_err_chars_display_max', '', 6);
 
 
--- UPLOADERS
-INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `override_class_file`) VALUES
-('bx_timeline_simple', 1, 'BxTimelineUploaderSimple', 'modules/boonex/timeline/classes/BxTimelineUploaderSimple.php');
-
-INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
-('bx_timeline_photos', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
-('bx_timeline_photos_preview', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos_preview', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
-('bx_timeline_photos_view', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos_view', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
-
-INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES
-('bx_timeline_photos_preview', 'bx_timeline_photos_preview', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0'),
-('bx_timeline_photos_view', 'bx_timeline_photos_view', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0');
-
-INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
-('bx_timeline_photos_preview', 'Resize', 'a:4:{s:1:"w";s:3:"100";s:1:"h";s:3:"100";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
-('bx_timeline_photos_view', 'Resize', 'a:4:{s:1:"w";s:3:"318";s:1:"h";s:3:"318";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
-
-
 -- ACL
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
 ('bx_timeline', 'post', NULL, '_bx_timeline_acl_action_post', '', 1, 1);

+ 18 - 0
modules/boonex/timeline/install/sql/install.sql

@@ -157,6 +157,24 @@ CREATE TABLE IF NOT EXISTS `bx_timeline_votes_track` (
 ) ENGINE=MYISAM DEFAULT CHARSET=utf8;
 
 
+-- STORAGES, TRANSCODERS, UPLOADERS
+INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `override_class_file`) VALUES
+('bx_timeline_simple', 1, 'BxTimelineUploaderSimple', 'modules/boonex/timeline/classes/BxTimelineUploaderSimple.php');
+
+INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
+('bx_timeline_photos', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
+('bx_timeline_photos_preview', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos_preview', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
+('bx_timeline_photos_view', 'Local', '', 360, 2592000, 3, 'bx_timeline_photos_view', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
+
+INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source_type`, `source_params`, `private`, `atime_tracking`, `atime_pruning`, `ts`) VALUES
+('bx_timeline_photos_preview', 'bx_timeline_photos_preview', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0'),
+('bx_timeline_photos_view', 'bx_timeline_photos_view', 'Storage', 'a:1:{s:6:"object";s:18:"bx_timeline_photos";}', 'no', '1', '2592000', '0');
+
+INSERT INTO `sys_transcoder_images_filters` (`transcoder_object`, `filter`, `filter_params`, `order`) VALUES
+('bx_timeline_photos_preview', 'Resize', 'a:4:{s:1:"w";s:3:"100";s:1:"h";s:3:"100";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0'),
+('bx_timeline_photos_view', 'Resize', 'a:4:{s:1:"w";s:3:"318";s:1:"h";s:3:"318";s:13:"square_resize";s:1:"1";s:10:"force_type";s:3:"jpg";}', '0');
+
+
 -- Forms -> Post
 INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
 ('mod_tml_post', @sName, '_bx_timeline_form_post', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');

+ 9 - 1
modules/boonex/timeline/install/sql/uninstall.sql

@@ -16,6 +16,14 @@ DROP TABLE IF EXISTS `bx_timeline_comments`;
 DROP TABLE IF EXISTS `bx_timeline_votes`;
 DROP TABLE IF EXISTS `bx_timeline_votes_track`;
 
+
+-- STORAGES, TRANSCODERS, UPLOADERS
+DELETE FROM `sys_objects_uploader` WHERE `object` = 'bx_timeline_simple';
+DELETE FROM `sys_objects_storage` WHERE `object` IN ('bx_timeline_photos', 'bx_timeline_photos_preview', 'bx_timeline_photos_view');
+DELETE FROM `sys_objects_transcoder_images` WHERE `object` IN ('bx_timeline_photos_preview', 'bx_timeline_photos_view');
+DELETE FROM `sys_transcoder_images_filters` WHERE `transcoder_object` IN ('bx_timeline_photos_preview', 'bx_timeline_photos_view');
+
+
 -- Forms All
 DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN  (SELECT `display_name` FROM `sys_form_displays` WHERE `module` = @sName);
 DELETE FROM `sys_form_inputs` WHERE `module` = @sName;
@@ -25,4 +33,4 @@ DELETE FROM `sys_objects_form` WHERE `module` = @sName;
 -- STUDIO PAGE & WIDGET
 DELETE FROM `tp`, `tw`, `tpw`
 USING `sys_std_pages` AS `tp`, `sys_std_widgets` AS `tw`, `sys_std_pages_widgets` AS `tpw`
-WHERE `tp`.`id` = `tw`.`page_id` AND `tw`.`id` = `tpw`.`widget_id` AND `tp`.`name` = @sName;
+WHERE `tp`.`id` = `tw`.`page_id` AND `tw`.`id` = `tpw`.`widget_id` AND `tp`.`name` = @sName;

+ 1 - 0
periodic/cron.php

@@ -14,6 +14,7 @@ require_once(BX_DIRECTORY_PATH_INC . 'utils.inc.php');
 require_once(BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
 
 bx_import('BxDolDb');
+bx_import('BxDolLanguages');
 
 function getRange($iLow, $iHigh, $iStep)
 {

+ 2 - 2
studio/classes/BxDolStudioInstaller.php

@@ -440,8 +440,8 @@ class BxDolStudioInstaller extends BxDolInstallerUtils {
         );
     }
     function _perform($sOperationName) {
-        if(!defined('BX_SKIP_INSTALL_CHECK') && !$GLOBALS['logged']['admin'])
-            return array('message' => '', 'result' => false);
+        if(!defined('BX_SKIP_INSTALL_CHECK') && !defined('BX_DOL_CRON_EXECUTE') && !$GLOBALS['logged']['admin'])
+            return array('message' => '_adm_mod_err_only_admin_can_perform_operations_with_modules', 'result' => false);
 
         $sMessage = '';
         foreach($this->_aConfig[$sOperationName] as $sAction => $iEnabled) {