/**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     schema::create('user', function (Blueprint $table) {
         $table->increments('id');
         $table->string('user_name', 25)->unique();
         $table->string('password');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     schema::create('identitas', function (Blueprint $table) {
         $table->increments('nama');
         $table->string('alamat');
         $table->string('jenis_kelamin');
         $table->string('tanggal_masuk');
         $table->timestamps();
     });
 }
 public function up()
 {
     schema::create('roles', function (Blueprint $table) {
         $table->integer('id_rol')->unique();
         $table->string('nombre_rol', 50);
         $table->integer('prioridad');
         $table->timestamps();
         $table->integer('id_participante')->unsigned();
         $table->foreign('id_participante')->references('id_participante')->on('participantes')->onDelete('cascade');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('tags', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->timestamps();
     });
     // Articles & Tags = article & tags = article_tags
     schema::create('article_tag', function (Blueprint $table) {
         $table->increments('id');
         $table->integer('article_id')->unsigned();
         $table->integer('tag_id')->unsigned();
         $table->foreign('article_id')->references('id')->on('articles')->onDelete('cascade');
         $table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
         $table->timestamps();
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('users', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('email')->unique();
         $table->string('password', 60);
         $table->boolean('is_active')->default(1);
         $table->boolean('confirmed')->default(0);
         $table->string('verification_key', 20)->unique();
         $table->rememberToken();
         $table->timestamps();
     });
     Schema::create('roles', function (Blueprint $table) {
         $table->increments('id');
         $table->string('role', 15);
         $table->timestamps();
     });
     schema::create('user_roles', function (Blueprint $table) {
         $table->integer('user_id')->unsigned()->index();
         $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
         $table->integer('role_id')->unsigned()->index();
         $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
     });
     Schema::create('companies', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name', 80);
         $table->string('email')->unique();
         $table->string('api_key', 60);
         $table->string('verification_key', 20)->unique();
         $table->string('domain_url', 100);
         $table->boolean('is_active')->default(0);
         $table->boolean('confirmed')->default(0);
         $table->timestamps();
     });
     Schema::create('users_companies', function (Blueprint $table) {
         $table->integer('user_id')->unsigned()->index();
         $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
         $table->integer('company_id')->unsigned()->index();
         $table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
         $table->boolean('is_active');
         $table->timestamps();
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     schema::drop('accept_credit');
 }
Exemplo n.º 7
0
<?php

if ($_view == 'reactivate_schema') {
    schema::update(array('schema_id' => $_GET['schema_id'], 'status' => 'on'));
}
include TEMPLATES_PATH . 'msg.html';
Exemplo n.º 8
0
function fetch_web($schemas, $test = null)
{
    global $_user, $_channels;
    $updated_file = array();
    foreach ($schemas as $k => $v) {
        if (!$v->channel && $v->url == '' || $v->keywords == '') {
            continue;
        }
        if ($v->channel) {
            $url_arr = $_channels[$v->channel]['url'];
        } else {
            $url_arr = explode(' ', $v->url);
        }
        foreach ($url_arr as $url_key => $url) {
            $url = mkurl($v->channel, $url_key, $url, $v->url);
            $filename = md5($url) . '.tmp';
            if (in_array($filename, $updated_file)) {
                $html = file_get_contents(CACHE_PATH . $filename);
            } else {
                $file = '';
                $context = $v->channel ? mkfp_context($url_key) : null;
                $html = file_get_contents($url, false, $context);
                $html = format_script($html);
                file_put_contents(CACHE_PATH . $filename, $html);
                $updated_file[] = $filename;
            }
            //处理关键词
            $keywords = $v->keywords;
            $encoding = mb_detect_encoding($html, array('ASCII', 'GB2312', 'GBK', 'UTF-8'));
            if ($encoding == 'EUC-CN') {
                $encoding = 'GB2312';
                $keywords = iconv('UTF-8', 'GBK', $keywords);
            } elseif ($encoding == 'CP936') {
                $keywords = iconv('UTF-8', $encoding, $keywords);
            }
            $keywords = explode(' ', $keywords);
            $first_key = array_shift($keywords);
            $lpos = 0;
            $rpos = NULL;
            $len = strlen($first_key);
            for ($lpos = strpos($html, $first_key, $lpos); $lpos !== false; $lpos = strpos($html, $first_key, $lpos + $len)) {
                $rpos = find_key($html, $keywords, $lpos + $len);
                if ($rpos) {
                    $html_len = strlen($html);
                    //得到关键词上下文
                    for ($j = 1; $j < 6 && $lpos !== false; $j++) {
                        $lpos = strrpos($html, '</', $lpos - $html_len - 2);
                    }
                    if (!$lpos) {
                        $lpos = 0;
                    }
                    for ($i = 1; $i < 5; $i++) {
                        $rpos = strpos($html, '</', $rpos + 2);
                    }
                    if (!$rpos) {
                        $rpos = $html_len;
                    }
                    $result = substr($html, $lpos, $rpos - $lpos);
                    break;
                }
            }
            $result = trim(strip_tags($result, '<a>'));
            //确定包含数字
            if ($v->max_num != '' || $v->min_num != '') {
                $result = find_num($result, $v->max_num, $v->min_num);
            }
            if ($result) {
                $result = str_replace(array("\n", "\r", "\t", "  "), '', $result);
                if ($encoding != 'UTF-8') {
                    $result = substr($result, 0, 400);
                    $result = iconv('GBK', 'UTF-8', $result);
                } else {
                    $result = mb_substr($result, 0, 400, 'utf8');
                }
                $website = isset($_channels[$v->channel]['website'][$url_key]) ? $_channels[$v->channel]['website'][$url_key] : $url;
                $content = $result . "<a href='{$website}' target='_blank'>查看</a>";
                if ($test) {
                    return $content;
                } else {
                    $_user = user::get_one(array('user_id' => $v->user_id));
                    schema::update(array('status' => 'off', 'schema_id' => $v->schema_id));
                    msg::add(array('schema_id' => $v->schema_id, 'title' => $v->title, 'content' => $content, 'status' => 'new'));
                    $email = filter_var($_user->email, FILTER_VALIDATE_EMAIL);
                    if ($_user->email_notify == 'on' && $email) {
                        mail::send_cron($email, $v->title, $content);
                    }
                    if ($_user->app_notify == 'on' && $_user->baidu_uid) {
                        push::push_message($_user->baidu_uid, $v->title, $result);
                    }
                }
                $result = NULL;
                break;
            }
        }
    }
}
Exemplo n.º 9
0
 protected function app_defaults()
 {
     $this->write_progress("\tRunning app_defaults");
     //set needed session settings
     $_SESSION["username"] = $this->admin_username;
     $_SESSION["domain_uuid"] = $this->global_settings->domain_uuid();
     require $this->config_php;
     require "resources/require.php";
     $_SESSION['event_socket_ip_address'] = $this->global_settings->event_host;
     $_SESSION['event_socket_port'] = $this->global_settings->event_port;
     $_SESSION['event_socket_password'] = $this->global_settings->event_password;
     //get the groups assigned to the user and then set the groups in $_SESSION["groups"]
     $sql = "SELECT * FROM v_group_users ";
     $sql .= "where domain_uuid=:domain_uuid ";
     $sql .= "and user_uuid=:user_uuid ";
     $prep_statement = $this->dbh->prepare(check_sql($sql));
     $prep_statement->bindParam(':domain_uuid', $this->global_settings->domain_uuid);
     $prep_statement->bindParam(':user_uuid', $this->admin_uuid);
     $prep_statement->execute();
     $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
     $_SESSION["groups"] = $result;
     unset($sql, $row_count, $prep_statement);
     //get the permissions assigned to the groups that the user is a member of set the permissions in $_SESSION['permissions']
     $x = 0;
     $sql = "select distinct(permission_name) from v_group_permissions ";
     foreach ($_SESSION["groups"] as $field) {
         if (strlen($field['group_name']) > 0) {
             if ($x == 0) {
                 $sql .= "where (domain_uuid = '" . $this->global_settings->domain_uuid . "' and group_name = '" . $field['group_name'] . "') ";
             } else {
                 $sql .= "or (domain_uuid = '" . $this->global_settings->domain_uuid . "' and group_name = '" . $field['group_name'] . "') ";
             }
             $x++;
         }
     }
     $prep_statement_sub = $this->dbh->prepare($sql);
     $prep_statement_sub->execute();
     $_SESSION['permissions'] = $prep_statement_sub->fetchAll(PDO::FETCH_NAMED);
     unset($sql, $prep_statement_sub);
     //include the config.php
     $db_type = $this->global_settings->db_type();
     $db_path = $this->global_settings->db_path();
     $db_host = $this->global_settings->db_host();
     $db_port = $this->global_settings->db_port();
     $db_name = $this->global_settings->db_name();
     $db_username = $this->global_settings->db_username();
     $db_password = $this->global_settings->db_password();
     //add the database structure
     require_once "resources/classes/schema.php";
     $schema = new schema();
     echo $schema->schema();
     //run all app_defaults.php files
     $default_language = $this->install_language;
     $domain = new domains();
     $domain->upgrade();
     //synchronize the config with the saved settings
     save_switch_xml();
     //do not show the apply settings reminder on the login page
     $_SESSION["reload_xml"] = false;
     //clear the menu
     $_SESSION["menu"] = "";
 }
Exemplo n.º 10
0
                $sql .= "where (domain_uuid = '" . $_SESSION["domain_uuid"] . "' and group_name = '" . $field['group_name'] . "') ";
            } else {
                $sql .= "or (domain_uuid = '" . $_SESSION["domain_uuid"] . "' and group_name = '" . $field['group_name'] . "') ";
            }
            $x++;
        }
    }
    $prep_statementsub = $db->prepare($sql);
    $prep_statementsub->execute();
    $_SESSION['permissions'] = $prep_statementsub->fetchAll(PDO::FETCH_NAMED);
    unset($sql, $prep_statementsub);
    //make sure the database schema and installation have performed all necessary tasks
    $display_results = false;
    $display_type = 'none';
    require_once "resources/classes/schema.php";
    $obj = new schema();
    $obj->schema($db, $db_type, $db_name, $display_type);
    //run all app_defaults.php files
    require_once "resources/classes/domains.php";
    $domain = new domains();
    $domain->upgrade();
    //synchronize the config with the saved settings
    save_switch_xml();
    //do not show the apply settings reminder on the login page
    $_SESSION["reload_xml"] = false;
    //clear the menu
    $_SESSION["menu"] = "";
    //redirect to the login page
    $msg = "install complete";
    header("Location: " . PROJECT_PATH . "/logout.php?msg=" . urlencode($msg));
}
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     schema::drop('movicheque');
 }
Exemplo n.º 12
0
             $result_count2 = count($result2);
             if ($result_count2 > 0) {
                 $sql3 = "update v_contacts set contact_email = '' ";
                 $sql3 .= "where domain_uuid = '" . $row['domain_uuid'] . "' ";
                 $sql3 .= "and contact_uuid = '" . $row['contact_uuid'] . "' ";
                 $prep_statement3 = $db->prepare(check_sql($sql3));
                 $prep_statement3->execute();
                 unset($sql3, $prep_statement3);
             }
             unset($sql2, $result2, $prep_statement2);
         }
     }
 }
 unset($obj);
 //populate primary url from deprecated field in v_contact table
 $obj = new schema();
 $obj->db = $db;
 $obj->db_type = $db_type;
 $obj->schema();
 $field_exists = $obj->column_exists($db_name, 'v_contacts', 'contact_url');
 //check if field exists
 if ($field_exists) {
     // get email records
     $sql = "select * from v_contacts where contact_url is not null and contact_url != ''";
     $prep_statement = $db->prepare(check_sql($sql));
     $prep_statement->execute();
     $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
     $result_count = count($result);
     unset($prep_statement, $sql);
     if ($result_count > 0) {
         foreach ($result as $row) {
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     schema::drop('advert_schedule');
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     schema::dropIfExists('what');
 }
Exemplo n.º 15
0
 public function database()
 {
     if (!\Schema::hasTable('addons')) {
         \Schema::create('addons', function (Blueprint $table) {
             $table->increments('id');
             $table->string('name');
             $table->integer('active')->default(0);
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE addons ADD INDEX `name`(`name`)");
     } catch (\Exception $e) {
     }
     /**
      * settings table
      */
     if (!\Schema::hasTable('configurations')) {
         \Schema::create('configurations', function (Blueprint $table) {
             $table->increments('id');
             $table->string('slug');
             $table->text('value');
             $table->timestamps();
         });
     }
     try {
         //@\DB::statement("ALTER TABLE configurations ADD INDEX `id`(`id`)");
         @\DB::statement("ALTER TABLE configurations ADD INDEX `slug`(`slug`)");
     } catch (\Exception $e) {
     }
     //update some configurations
     app('App\\Repositories\\ConfigurationRepository')->save(['enable-bigpipe' => 0]);
     app('App\\Repositories\\ConfigurationRepository')->save(['ajaxify_frontend' => 0]);
     app('App\\Repositories\\ConfigurationRepository')->save(['enable-realtime-activity' => 0]);
     app('App\\Repositories\\ConfigurationRepository')->save(['allow-files-types' => 'exe,txt,zip,rar,doc,mp3,jpg,png,css,psd,pdf,ppt,pptx,xls,xlsx,html,docx,fla,avi,mp4']);
     //let remove any php file already uploaded to the size
     $basePath = base_path('uploads/files/');
     if (is_dir($basePath)) {
         $fileSystem = app('files');
         $files = $fileSystem->allFiles($basePath);
         foreach ($files as $file) {
             $ext = $ext = pathinfo($file, PATHINFO_EXTENSION);
             if (strtolower($ext) == 'exe') {
                 @unlink($file);
             }
         }
     }
     /**
      * Languages table
      */
     if (!\Schema::hasTable('languages')) {
         \Schema::create("languages", function (Blueprint $table) {
             $table->increments('id');
             $table->string('var');
             $table->string("name");
             $table->integer('active')->default(0);
             $table->timestamps();
         });
         \DB::table('languages')->insert(['var' => 'en', 'name' => 'English Language', 'active' => 1]);
     }
     /**
      * User tables
      */
     if (!\Schema::hasTable('users')) {
         \Schema::create('users', function (Blueprint $table) {
             $table->increments('id');
             $table->string('fullname');
             $table->string('username');
             $table->string('email_address');
             $table->string('password');
             $table->string('genre')->default('male');
             $table->text('bio')->nullable();
             $table->text('profile_details')->nullable();
             $table->text('privacy_info')->nullable();
             $table->text('design_info')->nullable();
             $table->text('cover')->nullable();
             $table->string('country')->nullable();
             $table->integer('fully_started')->default(0);
             $table->text('avatar')->nullable();
             $table->string('auth')->default('');
             $table->string('auth_id')->default('');
             $table->integer('verified')->default(0);
             $table->integer('admin')->default(0);
             $table->integer('active')->default(0);
             $table->integer('activated')->default(0);
             $table->string('hash', 300)->default('');
             $table->string('remember_token', 300)->default('');
             $table->integer('last_active_time')->nullable();
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE users ADD INDEX `fullname`(`fullname`)");
         @\DB::statement("ALTER TABLE users ADD INDEX `username`(`username`)");
         @\DB::statement("ALTER TABLE users ADD INDEX `email_address`(`email_address`)");
         @\DB::statement("ALTER TABLE users ADD INDEX `genre`(`genre`)");
         @\DB::statement("ALTER TABLE users ADD INDEX `password`(`password`)");
         @\DB::statement("ALTER TABLE users ADD INDEX `country`(`country`)");
         @\DB::statement("ALTER TABLE users ADD INDEX `last_active_time`(`last_active_time`)");
     } catch (\Exception $e) {
     }
     /**custom fields***/
     if (!\Schema::hasTable('custom_fields')) {
         \Schema::create('custom_fields', function (Blueprint $table) {
             $table->increments('id');
             $table->string('name');
             $table->text('description');
             $table->string('field_type')->default('text');
             $table->string('type')->default('profile');
             $table->text('data')->nullable();
             $table->timestamps();
         });
     }
     //help add some fields to the site
     $this->addCustomFields();
     /**Post table**/
     if (!\Schema::hasTable('posts')) {
         \Schema::create('posts', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->integer('to_user_id')->nullable();
             $table->text('text')->nullable();
             $table->text('content_type')->nullable();
             $table->text('type_content')->nullable();
             $table->text('type')->nullable();
             $table->string('type_id')->default('');
             $table->integer('community_id')->nullable();
             $table->integer('page_id')->nullable();
             $table->text('link')->nullable();
             $table->text('tags')->nullable();
             $table->integer('privacy')->default(1);
             $table->integer('shared')->nullable();
             $table->integer('shared_id')->nullable();
             $table->integer('shared_from')->nullable();
             $table->integer('shared_count')->nullable();
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE posts ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE posts ADD INDEX `to_user_id`(`to_user_id`)");
         @\DB::statement("ALTER TABLE posts ADD INDEX `content_type`(`content_type`)");
         @\DB::statement("ALTER TABLE posts ADD INDEX `type`(`type`)");
         @\DB::statement("ALTER TABLE posts ADD INDEX `type_id`(`type_id`)");
         @\DB::statement("ALTER TABLE posts ADD INDEX `community_id`(`community_id`)");
         @\DB::statement("ALTER TABLE posts ADD INDEX `page_id`(`page_id`)");
         @\DB::statement("ALTER TABLE posts ADD INDEX `privacy`(`privacy`)");
         @\DB::statement("ALTER TABLE posts ADD INDEX `created_at`(`created_at`)");
         @\DB::statement("ALTER TABLE posts ADD INDEX `updated_at`(`updated_at`)");
     } catch (\Exception $e) {
     }
     /***coments***/
     if (!\Schema::hasTable('comments')) {
         \Schema::create('comments', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->text('text');
             $table->string('type');
             $table->string('type_id');
             $table->text('img_path')->nullable();
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE comments ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE comments ADD INDEX `type`(`type`)");
         @\DB::statement("ALTER TABLE comments ADD INDEX `type_id`(`type_id`)");
         @\DB::statement("ALTER TABLE comments ADD INDEX `created_at`(`created_at`)");
     } catch (\Exception $e) {
     }
     /***likes table**/
     if (!\Schema::hasTable('likes')) {
         \Schema::create('likes', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->string('type');
             $table->integer('type_id');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE likes ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE likes ADD INDEX `type`(`type`)");
         @\DB::statement("ALTER TABLE likes ADD INDEX `type_id`(`type_id`)");
     } catch (\Exception $e) {
     }
     /**connection table**/
     if (!\Schema::hasTable('connections')) {
         \Schema::create('connections', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->integer('to_user_id');
             $table->integer('way')->default(2);
             $table->integer('confirmed')->default(0);
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE connections ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE connections ADD INDEX `to_user_id`(`to_user_id`)");
         @\DB::statement("ALTER TABLE connections ADD INDEX `way`(`way`)");
     } catch (\Exception $e) {
     }
     /**Notification table**/
     if (!\Schema::hasTable('notifications')) {
         \Schema::create('notifications', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->integer('to_user_id');
             $table->text('title')->nullable();
             $table->text('content')->nullable();
             $table->text('data')->nullable();
             $table->integer('seen')->default(0);
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE notifications ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE notifications ADD INDEX `to_user_id`(`to_user_id`)");
     } catch (\Exception $e) {
     }
     /**Blocked users**/
     if (!\Schema::hasTable('blocked_users')) {
         \Schema::create('blocked_users', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->integer('block_id');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE blocked_users ADD INDEX `user_id`(`user_id`)");
     } catch (\Exception $e) {
     }
     /**User get notifications table**/
     if (!\Schema::hasTable('notification_receivers')) {
         \Schema::create('notification_receivers', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->string('type');
             $table->integer('type_id');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE notification_receivers ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE notification_receivers ADD INDEX `type`(`type`)");
         @\DB::statement("ALTER TABLE notification_receivers ADD INDEX `type_id`(`type_id`)");
     } catch (\Exception $e) {
     }
     /**Hashtags table**/
     if (!\Schema::hasTable('hashtags')) {
         \Schema::create('hashtags', function (Blueprint $table) {
             $table->increments('id');
             $table->string('hash');
             $table->integer('count');
             $table->timestamps();
         });
     }
     /**Reports table**/
     if (!\Schema::hasTable('reports')) {
         \Schema::create('reports', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->text('url');
             $table->string('type');
             $table->text('reason');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE reports ADD INDEX `type`(`type`)");
     } catch (\Exception $e) {
     }
     /**Additional pages table***/
     if (!\Schema::hasTable('additional_pages')) {
         \Schema::create('additional_pages', function (Blueprint $table) {
             $table->increments('id');
             $table->string('slug');
             $table->string('title');
             $table->text('content');
             $table->timestamps();
         });
     }
     $this->addAdditionalPages();
     /**Help system***/
     if (!\Schema::hasTable('helps')) {
         \Schema::create('helps', function (Blueprint $table) {
             $table->increments('id');
             $table->string('title');
             $table->string('slug');
             $table->text('content');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE helps ADD INDEX `slug`(`slug`)");
     } catch (\Exception $e) {
     }
     $this->addHelps();
     /***Communities***/
     if (!\Schema::hasTable('communities')) {
         \Schema::create('communities', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->string('title');
             $table->string('slug');
             $table->text('description')->nullable();
             $table->text('info')->nullable();
             $table->text('moderators')->nullable();
             $table->integer('privacy')->default(0);
             $table->integer('can_join')->default(1);
             $table->integer('can_post')->default(1);
             $table->integer('can_invite')->default(1);
             //$table->integer('can_create_category');
             $table->integer('searchable')->default(1);
             $table->string('logo')->nullable();
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE communities ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE communities ADD INDEX `slug`(`slug`)");
         @\DB::statement("ALTER TABLE communities ADD INDEX `created_at`(`created_at`)");
         @\DB::statement("ALTER TABLE communities ADD INDEX `privacy`(`privacy`)");
         @\DB::statement("ALTER TABLE communities ADD INDEX `searchable`(`searchable`)");
     } catch (\Exception $e) {
     }
     //communities members
     if (!\Schema::hasTable('community_members')) {
         \Schema::create('community_members', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('community_id');
             $table->integer('user_id');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE community_members ADD INDEX `community_id`(`community_id`)");
     } catch (\Exception $e) {
     }
     //community categories
     if (!\Schema::hasTable('community_categories')) {
         \Schema::create('community_categories', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('community_id');
             $table->string('title');
             $table->string('slug');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE community_categories ADD INDEX `community_id`(`community_id`)");
         @\DB::statement("ALTER TABLE community_categories ADD INDEX `slug`(`slug`)");
     } catch (\Exception $e) {
     }
     //invited members
     if (!\Schema::hasTable('invited_members')) {
         \Schema::create('invited_members', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->integer('type_id');
             $table->string('type');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE invited_members ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE invited_members ADD INDEX `type_id`(`type_id`)");
         @\DB::statement("ALTER TABLE invited_members ADD INDEX `type`(`type`)");
     } catch (\Exception $e) {
     }
     //photos
     if (!\Schema::hasTable('photos')) {
         \schema::create('photos', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->string('slug');
             $table->string('path');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE photos ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE photos ADD INDEX `slug`(`slug`)");
         @\DB::statement("ALTER TABLE photos ADD INDEX `path`(`path`)");
     } catch (\Exception $e) {
     }
     if (!\Schema::hasTable('photo_albums')) {
         \Schema::create('photo_albums', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->string('title');
             $table->string('slug');
             $table->string('default_photo')->nullable();
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE photo_albums ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE photo_albums ADD INDEX `slug`(`slug`)");
     } catch (\Exception $e) {
     }
     //pages
     if (!\Schema::hasTable('pages')) {
         \Schema::create('pages', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->integer('category_id');
             $table->string('title');
             $table->string('slug');
             $table->string('description')->nullable();
             $table->text('info')->nullable();
             $table->string('website')->nullable();
             $table->string('logo')->nullable();
             $table->string('cover')->nullable();
             $table->integer('verified')->default(0);
             //$table->integer('can_post')->default(0);
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE pages ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE pages ADD INDEX `slug`(`slug`)");
         @\DB::statement("ALTER TABLE pages ADD INDEX `title`(`title`)");
         @\DB::statement("ALTER TABLE pages ADD INDEX `description`(`description`)");
     } catch (\Exception $e) {
     }
     if (!\Schema::hasTable('page_categories')) {
         \Schema::create('page_categories', function (Blueprint $table) {
             $table->increments('id');
             $table->string('title');
             $table->string('slug');
             $table->string('description');
             $table->timestamps();
         });
     }
     $this->addPagesCategories();
     //message table
     if (!\Schema::hasTable('messages')) {
         \Schema::create('messages', function (Blueprint $table) {
             $table->increments('id');
             $table->text('text');
             $table->integer('sender');
             $table->integer('receiver');
             $table->string('image')->nullable();
             $table->integer('conversation_id');
             $table->integer('sender_status')->default(0);
             $table->integer('receiver_status')->default(0);
             $table->integer('seen')->default(0);
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE messages ADD INDEX `sender`(`sender`)");
         @\DB::statement("ALTER TABLE message ADD INDEX `receiver`(`receiver`)");
         @\DB::statement("ALTER TABLE messages ADD INDEX `conversation_id`(`conversation_id`)");
         @\DB::statement("ALTER TABLE messages ADD INDEX `sender_status`(`sender_status`)");
         @\DB::statement("ALTER TABLE messages ADD INDEX `receiver_status`(`receiver_status`)");
         @\DB::statement("ALTER TABLE messages ADD INDEX `seen`(`seen`)");
         @\DB::statement("ALTER TABLE messages ADD INDEX `created_at`(`created_at`)");
     } catch (\Exception $e) {
     }
     if (!\Schema::hasTable('message_conversation')) {
         \Schema::create('message_conversation', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user1');
             $table->integer('user2');
             $table->timestamps();
         });
     }
     //newsletter
     if (!\Schema::hasTable('newsletters')) {
         \Schema::create('newsletters', function (Blueprint $table) {
             $table->increments('id');
             $table->string('subject');
             $table->text('content');
             $table->string('to');
             $table->timestamps();
         });
     }
     //v1.3
     if (!\Schema::hasTable('post_hide')) {
         \Schema::create('post_hide', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('post_id');
             $table->integer('user_id');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE post_hide ADD INDEX `user_id`(`user_id`)");
         @\DB::statement("ALTER TABLE post_hide ADD INDEX `post_id`(`post_id`)");
     } catch (\Exception $e) {
     }
     //v1.4
     if (!\Schema::hasTable('page_admins')) {
         \Schema::create('page_admins', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('page_id');
             $table->integer('user_id');
             $table->string('type');
             $table->integer('approved')->default(0);
             $table->timestamps();
         });
     }
     //v3.0
     if (!\Schema::hasTable('must_avoid_users')) {
         \Schema::create('must_avoid_users', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id');
             $table->timestamps();
         });
     }
     try {
         @\DB::statement("ALTER TABLE must_avoid_users ADD INDEX `user_id`(`user_id`)");
     } catch (\Exception $e) {
     }
     //run updates for database
     $this->runUpdate();
 }
Exemplo n.º 16
0
<?php

$template = 'schema.html';
if ($_view == 'edit') {
    $template = 'schema_edit.html';
    if ($_POST['submit_schema_activate']) {
        $_POST['status'] = 'on';
        $_POST['submit_schema'] = 1;
    }
    if ($_POST['submit_schema']) {
        if (is_numeric($_POST['schema_id'])) {
            schema::update($_POST);
            $template = 'schema.html';
        } else {
            schema::add($_POST);
            $template = 'schema.html';
        }
    }
} elseif ($_view == 'test') {
    $keywords = str_replace('^^', ' ', $_REQUEST['keywords']);
    $schema = array('channel' => $_REQUEST['channel'], 'url' => $_REQUEST['url'], 'keywords' => $keywords);
    $result = fetch_web(array((object) $schema), true);
    echo $result;
    exit;
} elseif ($_view == 'del') {
    schema::delete($_GET);
}
include TEMPLATES_PATH . $template;
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     schema::drop('students');
 }
Exemplo n.º 18
0
    $format = 'text';
    //html, text
    //add multi-lingual support
    $language = new text();
    $text = $language->get();
} else {
    if (!$included) {
        include "root.php";
        require_once "resources/require.php";
        require_once "resources/check_auth.php";
        if (permission_exists('upgrade_schema') || if_group("superadmin")) {
            //echo "access granted";
        } else {
            echo "access denied";
            exit;
        }
        require_once "resources/header.php";
        $document['title'] = $text['title-upgrade_schema'];
        $format = 'html';
        //html, text
    }
}
//get the database schema put it into an array then compare and update the database as needed.
require_once "resources/classes/schema.php";
$obj = new schema();
echo $obj->schema($format);
if (!$included && $format == 'html') {
    echo "<br />\n";
    echo "<br />\n";
    require_once "resources/footer.php";
}
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     schema::drop('role');
 }
Exemplo n.º 20
0
}
require_once "resources/classes/text.php";
//add multi-lingual support
$language = new text();
$text = $language->get();
//show the title
if ($format == 'text') {
    echo "\n";
    echo $text['label-upgrade'] . "\n";
    echo "-----------------------------------------\n";
    echo "\n";
    echo $text['label-database'] . "\n";
}
//make sure the database schema and installation have performed all necessary tasks
require_once "resources/classes/schema.php";
$obj = new schema();
echo $obj->schema("text");
//run all app_defaults.php files
require_once "resources/classes/domains.php";
$domain = new domains();
$domain->upgrade();
//show the content
if ($format == 'html') {
    echo "<div align='center'>\n";
    echo "<table width='40%'>\n";
    echo "<tr>\n";
    echo "<th align='left'>" . $text['header-message'] . "</th>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "<td class='row_style1'><strong>" . $text['message-upgrade'] . "</strong></td>\n";
    echo "</tr>\n";
Exemplo n.º 21
0
             $obj = new install_switch();
             $obj->upgrade();
             //set the message
             $response_message = $text['message-upgrade_source_scripts'];
         } else {
             //set the message
             $response_message = $text['message-upgrade_source'];
         }
     }
 }
 // load an array of the database schema and compare it with the active database
 if ($do["schema"] && permission_exists("upgrade_schema")) {
     $response_message = $text['message-upgrade_schema'];
     $upgrade_data_types = check_str($do["data_types"]);
     require_once "resources/classes/schema.php";
     $obj = new schema();
     $_SESSION["schema"]["response"] = $obj->schema("html");
 }
 // process the apps defaults
 if ($do["apps"] && permission_exists("upgrade_apps")) {
     $response_message = $text['message-upgrade_apps'];
     require_once "resources/classes/domains.php";
     $domain = new domains();
     $domain->upgrade();
 }
 // restore defaults of the selected menu
 if ($do["menu"] && permission_exists("menu_restore")) {
     $sel_menu = explode('|', check_str($_POST["sel_menu"]));
     $menu_uuid = $sel_menu[0];
     $menu_language = $sel_menu[1];
     $included = true;
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     schema::drop('events');
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('categories', function (Blueprint $table) {
         schema::drop('categories');
     });
 }