Пример #1
0
 public function run()
 {
     User::truncate();
     $user = User::create(array("username" => "danielheyman", "name" => "Daniel Heyman", "email" => "*****@*****.**", "password" => "hello", "newsletter" => true, "admin_emails" => true, "membership" => "platinum", "admin" => true, "paypal" => "", "membership_expires" => Carbon::now()->addMonth(), "referrals" => 0, "upline" => "", "cash" => 0, "credits" => 0, "credits_today" => 0, "views_total" => 0, "views_today" => 0, 'auto_assign' => 0, 'register_ip' => Request::getClientIp(), 'last_login' => Carbon::now()));
     register_event($user, Request::getClientIp(), "http://activation.link");
     login_event($user);
 }
Пример #2
0
 public function registerUser()
 {
     if ($this->validators->get("MakeUser")->fails()) {
         return $this->setError($this->validators->get("MakeUser"));
     }
     $options = array('username' => Input::get('username'), 'name' => Input::get('name'), 'email' => Input::get('email'), 'password' => Input::get('password'), 'activation' => str_random(6), 'newsletter' => true, 'admin_emails' => true, 'credits' => 0, 'credits_today' => 0, 'membership' => "free", 'views_today' => 0, 'views_total' => 0, 'register_ip' => Request::getClientIp(), 'auto_assign' => 0, 'cash' => 0, 'referrals' => 0);
     if ($referralManager->addReferralFromCookies()->passes()) {
         $options["upline"] = Cookie::get('ref');
         $options["upline_source"] = Cookie::get('source');
         $options["upline_page"] = Cookie::get('page');
     }
     $user = new $this->user($options);
     register_event($user, Request::getClientIp(), URL::to('activate', $user->activation));
     return $this;
 }
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once 'inc/events.php';
define('SKIP_ARTICLES', 1);
include_once 'inc/news.php';
register_event(new Event_Player_Log());
class Event_Player_Log extends Event
{
    public function getRunTime()
    {
        return PLAYER_LOG_TIME;
    }
    public function run()
    {
        global $db;
        $db = isset($db) ? $db : new DB();
        $time = time();
        // Grab a batch of log entries sorted by time descending...
        $rs = $db->get_db()->query("select * from player_log where reconciled <= 0 and (action >= 7 and action <= 10) order by timestamp desc");
        if (!$rs) {
            error_log(__FILE__ . '::' . __LINE__ . " Query selection failed: (" . $db->get_db()->errno . ") " . $db->get_db()->error);
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once 'inc/events.php';
register_event(new Event_Housekeeping());
class Event_Housekeeping extends Event
{
    public function getRunTime()
    {
        return HOUSEKEEPING_TIME;
    }
    public function run()
    {
        global $db;
        $db = isset($db) ? $db : new DB();
        $time = time();
        // Expired alliance requests
        $request_time = $time - OPEN_REQUEST_DAYS * 3600 * 24;
        $reject_time = $time - REJECTED_REQUEST_DAYS * 3600 * 24;
        if (!($st = $db->get_db()->prepare('delete from alliance_invitations where requested <= ? or (rejected > 0 and rejected <= ?)'))) {
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once 'inc/events.php';
register_event(new Event_Port_Goods());
class Event_Port_Goods extends Event
{
    public function getRunTime()
    {
        return PORT_EVENT_CYCLE;
    }
    public function run()
    {
        global $db;
        $db = isset($db) ? $db : new DB();
        $time = time();
        // Ports first
        $update_ports = array();
        $update_ports_count = 0;
        $rs = $db->get_db()->query("select * from port_goods where upgrade = 0 and last_update < " . ($time - PORT_UPDATE_TIME) . " and ((supply = 0 and amount > '" . -PORT_LIMIT . "') or (supply = 1 and amount < '" . PORT_LIMIT . "')) order by last_update limit " . PORTS_PER_UPDATE);
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once 'inc/events.php';
include_once 'inc/goods.php';
include_once 'inc/place_types.php';
include_once 'inc/galaxy.php';
register_event(new Event_Upgrade_Ports());
class Event_Upgrade_Ports extends Event
{
    private $upgrade_paths = array();
    private $reverse_upgrade_paths = array();
    private $port_place_types = array();
    public function __construct()
    {
        global $db;
        $db = isset($db) ? $db : new DB();
        global $spacegame;
        foreach ($spacegame['place_types'] as $type => $row) {
            if ($row['port_goods'] > 0) {
                $this->port_place_types[$type] = $row['port_goods'];
                $place_types[] = $type;
            }
 * @package [Redacted]Me
 * ---------------------------------------------------------------------------
 *
 * Merchant Empires by [Redacted] Games LLC - A space merchant game of war
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once 'inc/events.php';
register_event(new Event_Timestamp());
class Event_Timestamp extends Event
{
    public function getRunTime()
    {
        return TIMESTAMP_TIME;
    }
    public function run()
    {
        echo "TIMESTAMP (RFC850): " . date(DATE_RFC850) . "\n";
    }
}