Пример #1
0
 public function enable_step($old_state)
 {
     global $phpbb_root_path;
     switch ($old_state) {
         case '':
             $db = new \florinp\messenger\libs\database();
             $db->exec("\n          CREATE TABLE IF NOT EXISTS messages (\n            `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n            `sender_id` INTEGER NOT NULL,\n            `receiver_id` INTEGER NOT NULL,\n            `text` TEXT NOT NULL,\n            `newMsg` INTEGER DEFAULT 0,\n            `sentAt` INTEGER NOT NULL\n          );\n          CREATE TABLE IF NOT EXISTS files (\n            `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n            `sender_id` INTEGER NOT NULL,\n            `receiver_id` INTEGER NOT NULL,\n            `fileName` VARCHAR(255) NOT NULL,\n            `file` VARCHAR(255) NOT NULL,\n            `type` VARCHAR(255) NOT NULL,\n            `sentAt` INTEGER NOT NULL\n          );\n        ");
             $messengerDir = $phpbb_root_path . 'store/messenger';
             if (!is_dir($messengerDir)) {
                 mkdir($messengerDir, 0777);
                 $filesDir = $messengerDir . '/files';
                 if (!is_dir($filesDir)) {
                     mkdir($filesDir, 0777);
                 }
             }
             return 'notifications';
             break;
         case 'notifications':
             $phpbb_notifications = $this->container->get('notification_manager');
             $phpbb_notifications->enable_notifications('florinp.messenger.notification.type.friend_request');
             return 'step2';
             break;
         default:
             return parent::enable_step($old_state);
             break;
     }
 }
Пример #2
0
 public function enable_step($old_state)
 {
     switch ($old_state) {
         case '':
             $db = new \florinp\messenger\libs\database();
             $db->exec("\n          CREATE TABLE IF NOT EXISTS messages (\n            `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n            `sender_id` INTEGER NOT NULL,\n            `receiver_id` INTEGER NOT NULL,\n            `text` TEXT NOT NULL,\n            `newMsg` INTEGER DEFAULT 0,\n            `sentAt` INTEGER NOT NULL\n          );\n        ");
             return 'notifications';
             break;
         case 'notifications':
             $phpbb_notifications = $this->container->get('notification_manager');
             $phpbb_notifications->enable_notifications('florinp.messenger.notification.type.friend_request');
             return 'step2';
             break;
         default:
             return parent::enable_step($old_state);
             break;
     }
 }