X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fextensions%2Fext-surfbar.php;h=6ee4cd5b7ac18d2102824e35ce9a1bc0d45fef6f;hp=e67e15bb1d35283e59031bb0e00ba15a8d2f5e68;hb=be39a7fb887473487fd2c5f8d550aa03b720cb73;hpb=dfaa8c1675da4071ea451406a6f6fedd4c568416 diff --git a/inc/extensions/ext-surfbar.php b/inc/extensions/ext-surfbar.php index e67e15bb1d..6ee4cd5b7a 100644 --- a/inc/extensions/ext-surfbar.php +++ b/inc/extensions/ext-surfbar.php @@ -1,7 +1,7 @@ Vorsicht! Ihnen muss es auch gestattet sein, URLs aus dem Werbenetzwerk in die Surfbar einzufügen.',1)"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','list_surfbar_urls','URLs verwalten','Verwalten Sie hier alle in der Surfbar befindlichen URLs mit nur wenigen Klicks.',2)"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','unlock_surfbar_urls','Wartende URLs freigeben','Geben Sie hier nur direkt in der Surfbar gebuchte URLs frei.',3)"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','config_surfbar','Einstellungen','Einstellungen an der Surfbar ändern, wie Festvergütung, prozentuale Ref-Vergütung und vieles mehr.',4)"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','surfbar_stats','Statistiken','Detailierte Statistiken zu einer ausgewählten URL anzeigen.',5)"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','surfbar_actions','Mitgliederaktionen','Listet alle Mitgliederaktionen auf.',6)"; - - // Load CSS? - $EXT_CSS = "Y"; - break; - -case "remove": // Do stuff when removing extension - // SQL commands to run - $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_actions`"; - $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_locks`"; - $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_salts`"; - $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_stats`"; - $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_urls`"; - $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE `action`='surfbar' LIMIT 5"; - $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE `action`='surfbar' LIMIT 7"; - break; - -case "activate": // Do stuff when admin activates this extension - // SQL commands to run - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET `visible`='Y', `locked`='N' WHERE `action`='surfbar' LIMIT 5"; - break; - -case "deactivate": // Do stuff when admin deactivates this extension - // SQL commands to run - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET `locked`='Y' WHERE `action` = 'surfbar' LIMIT 5"; - break; - -case "update": // Update an extension - switch ($EXT_VER) - { - case "0.0.1": // SQL queries for v0.0.1 - $SQLs[] = ""; - - // Update notes (these will be set as task text!) - $UPDATE_NOTES = ""; +`url_last_salt` VARCHAR(255) NOT NULL DEFAULT '', +`url_views_total` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`url_views_max` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`url_views_allowed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`url_status` ENUM('PENDING','ACTIVE','LOCKED','STOPPED','REJECTED','DELETED','MIGRATED','DEPLETED') NOT NULL DEFAULT 'PENDING', +`url_registered` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +`url_last_locked` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', +`url_lock_reason` VARCHAR(255) NOT NULL DEFAULT '', +`url_reject_reason` VARCHAR(255) NOT NULL DEFAULT '', +`url_fixed_reload` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +PRIMARY KEY (`url_id`), +UNIQUE KEY `userid_url` (`url_userid`,`url`), +INDEX `status_userid` (`url_status`,`url_userid`) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar URLs'"); + + // Reload locks + addDropTableSql('surfbar_locks'); + addCreateTableSql('surfbar_locks', "( +`locks_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`locks_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`locks_url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`locks_last_surfed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`locks_id`), +UNIQUE KEY `userid_url` (`locks_userid`,`locks_url_id`), +INDEX (`locks_url_id`) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar reload locks'"); + + // Surfbar salts + addDropTableSql('surfbar_salts'); + addCreateTableSql('surfbar_salts', "( +`salts_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`salts_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`salts_url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`salts_last_salt` VARCHAR(255) NOT NULL DEFAULT '', +PRIMARY KEY (`salts_id`), +UNIQUE KEY `salts_userid_url` (`salts_userid`,`salts_url_id`), +INDEX (`salts_url_id`) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar last used salts'"); + + // Statistics + addDropTableSql('surfbar_stats'); + addCreateTableSql('surfbar_stats', "( +`stats_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`stats_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`stats_url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`stats_count` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`stats_last_surfed` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`stats_id`), +UNIQUE KEY `userid_url` (`stats_userid`,`stats_url_id`), +INDEX (`stats_url_id`) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar Statistics'"); + + // Member actions pending on status + addDropTableSql('surfbar_actions'); + addCreateTableSql('surfbar_actions', "( +`actions_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`actions_status` ENUM('PENDING','ACTIVE','LOCKED','STOPPED','REJECTED','DELETED','MIGRATED','DEPLETED') NULL DEFAULT NULL, +`actions_action` ENUM('EDIT','DELETE','PAUSE','UNPAUSE','FRAMETEST','RETREAT','RESUBMIT','BOOKNOW') NULL DEFAULT NULL, +`actions_new_status` ENUM('PENDING','ACTIVE','LOCKED','STOPPED','REJECTED','DELETED','MIGRATED','DEPLETED') NULL DEFAULT NULL, +PRIMARY KEY (`actions_id`), +UNIQUE KEY `status_action` (`actions_status`,`actions_action`) +) ENGINE = {?_TABLE_TYPE?} CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT = 'Surfbar Member Actions'"); + + // Member actions + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('PENDING','RETREAT','DELETED')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('PENDING','FRAMETEST',NULL)"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('PENDING','EDIT',NULL)"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('ACTIVE','EDIT','PENDING')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('ACTIVE','DELETE','DELETED')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('ACTIVE','PAUSE','STOPPED')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('ACTIVE','FRAMETEST',NULL)"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('LOCKED','DELETE','DELETED')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('LOCKED','FRAMETEST',NULL)"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('LOCKED','RESUBMIT','PENDING')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('STOPPED','EDIT','PENDING')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('STOPPED','DELETE','DELETED')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('STOPPED','UNPAUSE','PENDING')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('DEPLETED','EDIT','PENDING')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('DEPLETED','DELETE','DELETED')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('REJECTED','EDIT','PENDING')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('REJECTED','DELETE','DELETED')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('REJECTED','FRAMETEST',NULL)"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('REJECTED','RESUBMIT','PENDING')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('MIGRATED','EDIT','MIGRATED')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('MIGRATED','DELETE','DELETED')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('MIGRATED','FRAMETEST',NULL)"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('MIGRATED','BOOKNOW','PENDING')"); + + // Config entries + addConfigAddSql('surfbar_pay_model', "ENUM('STATIC','DYNAMIC') NOT NULL DEFAULT 'STATIC'"); + addConfigAddSql('surfbar_static_reward', "FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.25000"); + addConfigAddSql('surfbar_static_costs', "FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000"); + addConfigAddSql('surfbar_static_time', "SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60"); + addConfigAddSql('surfbar_static_lock', "SMALLINT(6) UNSIGNED NOT NULL DEFAULT ".(60*5).""); + addConfigAddSql('surfbar_dynamic_percent', "FLOAT(10,5) UNSIGNED NOT NULL DEFAULT 10.00000"); + addConfigAddSql('surfbar_max_order', "INT(7) UNSIGNED NOT NULL DEFAULT 10"); + addConfigAddSql('surfbar_restart_time', "BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(60*6).""); + addConfigAddSql('surfbar_autostart', "ENUM('Y','N') NOT NULL DEFAULT 'Y'"); + addConfigAddSql('surfbar_migrate_urls', "ENUM('Y','N') NOT NULL DEFAULT 'Y'"); + addConfigAddSql('surfbar_total_counter', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addConfigAddSql('surfbar_daily_counter', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addConfigAddSql('surfbar_yester_counter', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addConfigAddSql('surfbar_weekly_counter', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addConfigAddSql('surfbar_monthly_counter', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"); + addConfigAddSql('surfbar_stats_reload', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 30"); + addConfigAddSql('surfbar_purge_deleted', "BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay()*7).""); + addConfigAddSql('surfbar_purge_migrated', "BIGINT(20) UNSIGNED NOT NULL DEFAULT ".(getOneDay()*3).""); + addConfigAddSql('surfbar_pause_mode', "ENUM('INTERNAL','EXERNAL') NOT NULL DEFAULT 'INTERNAL'"); + addConfigAddSql('surfbar_pause_url', "VARCHAR(255) NOT NULL DEFAULT ''"); + addConfigAddSql('surfbar_notify_limits', "ENUM('Y','N') NOT NULL DEFAULT 'Y'"); + addConfigAddSql('surfbar_notify_admin_unlock', "ENUM('Y','N') NOT NULL DEFAULT 'Y'"); + addConfigAddSql('surfbar_warn_low_points', "BIGINT(20) UNSIGNED NOT NULL DEFAULT 100"); + addConfigAddSql('surfbar_low_interval', "BIGINT(20) UNSIGNED NOT NULL DEFAULT {?ONE_DAY?}"); + addConfigAddSql('surfbar_migrate_order', "ENUM('Y','N') NOT NULL DEFAULT 'Y'"); + addConfigAddSql('surfbar_notification_mode', "ENUM('INSTANT','RESET') NOT NULL DEFAULT 'INSTANT'"); + addConfigAddSql('surfbar_guest_login_form', "ENUM('Y','N') NOT NULL DEFAULT 'Y'"); + + // Extend user data + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `surfbar_low_notified` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'"); + + // Member menus + addMemberMenuSql('surfbar',NULL,'Surfbar','N','Y',4); + addMemberMenuSql('surfbar','surfbar_start','Surfbar starten','N','Y',1); + addMemberMenuSql('surfbar','surfbar_book','Seite buchen','N','Y',2); + addMemberMenuSql('surfbar','surfbar_list','Seiten-Management','N','Y',3); + addMemberMenuSql('surfbar','surfbar_stats','Seiten-Statistik','N','Y',4); + + // Admin menus + addAdminMenuSql('surfbar',NULL,'Surfbar','URLs in der Surfbar verwalten, Einstellungen ändern und vieles mehr.',7); + addAdminMenuSql('surfbar','add_surfbar_url','URL hinzufügen','Fügen Sie URLs z.B. von Werbenetzwerken hinzu, oder Ihre eigenen Projekte. Vorsicht! Ihnen muss es auch gestattet sein, URLs aus dem Werbenetzwerk in die Surfbar einzufügen.',1); + addAdminMenuSql('surfbar','list_surfbar_urls','URLs verwalten','Verwalten Sie hier alle in der Surfbar befindlichen URLs mit nur wenigen Klicks.',2); + addAdminMenuSql('surfbar','unlock_surfbar_urls','Wartende URLs freigeben','Geben Sie hier nur direkt in der Surfbar gebuchte URLs frei.',3); + addAdminMenuSql('surfbar','config_surfbar','Einstellungen','Einstellungen an der Surfbar ändern, wie Festvergütung, prozentuale Ref-Vergütung und vieles mehr.',4); + addAdminMenuSql('surfbar','surfbar_stats','Statistiken','Detailierte Statistiken zu einer ausgewählten URL anzeigen.',5); + addAdminMenuSql('surfbar','list_surfbar_actions','Mitgliederaktionen','Listet alle Mitgliederaktionen auf.',6); + + // Register module + addModuleSql('surfbar','Y','Y','N','N'); + break; + + case 'remove': // Do stuff when removing extension + // SQL commands to run + addDropTableSql('surfbar_actions'); + addDropTableSql('surfbar_locks'); + addDropTableSql('surfbar_salts'); + addDropTableSql('surfbar_stats'); + addDropTableSql('surfbar_urls'); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='surfbar'"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='surfbar'"); + + // Unregister module + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='surfbar' LIMIT 1"); + break; + + case 'activate': // Do stuff when admin activates this extension + // SQL commands to run + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `action`='surfbar' LIMIT 5"); + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='N', `hidden`='N', `admin_only`='N', `mem_only`='Y' WHERE `module`='surfbar' LIMIT 1"); + break; + + case 'deactivate': // Do stuff when admin deactivates this extension + // SQL commands to run + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `action` = 'surfbar' LIMIT 5"); + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='Y' WHERE `module`='surfbar' LIMIT 1"); break; - } - break; -default: // Do stuff when extension is loaded - break; -} + case 'update': // Update an extension + switch (getCurrentExtensionVersion()) { + case '0.0.1': // SQL queries for v0.0.1 + addExtensionSql(''); -// Language file prefix -$EXT_LANG_PREFIX = "surfbar"; + // Update notes (these will be set as task text!) + setExtensionUpdateNotes(''); + break; + } // END - switch + break; + + case 'modify': // When the extension got modified + break; + + case 'test': // For testing purposes + break; + + case 'init': // Do stuff when extension is initialized + break; + + default: // Unknown extension mode + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s in extension %s detected.", getExtensionMode(), getCurrentExtensionName())); + break; +} // END - switch -// +// [EOF] ?>