Beispiel #1
0
 /**
  * Retrieves a single Tenant with the given URL.
  * @param string $url The URL of the Tenant to return
  * @return NULL|\PhoenixSNS\Objects\Tenant The Tenant with the given URL, or null if no Tenant with the given URL was found
  */
 public static function GetByURL($url)
 {
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "Tenants WHERE tenant_URL = '" . $MySQL->real_escape_string($url) . "'";
     $result = $MySQL->query($query);
     if ($result === false) {
         echo "<html><head><title>Initialization Failure</title></head><body><h1>Initialization Failure</h1><p>A fatal error occurred when attempting to initialize the PhoenixSNS runtime.  Please make sure PhoenixSNS has been installed correctly on the server.</p><p>The PhoenixSNS runtime cannot be loaded (1001). Please contact the Web site administrator to inform them of this problem.</p><hr /><h3>System information</h3><table><tr><td>Tenant:</td><td>" . $url . "</td></tr><tr><td>Server: </td><td>" . $_SERVER["HTTP_HOST"] . "</td></tr></table></body></html>";
         die;
         return null;
     }
     $count = $result->num_rows;
     if ($count == 0) {
         echo "<html><head><title>Initialization Failure</title></head><body><h1>Initialization Failure</h1><p>A fatal error occurred when attempting to initialize the PhoenixSNS runtime.  Please make sure PhoenixSNS has been installed correctly on the server.</p><p>The PhoenixSNS runtime cannot find the requested tenant (1002). Please contact the Web site administrator to inform them of this problem.</p><hr /><h3>System information</h3><table><tr><td>Tenant:</td><td>" . $url . "</td></tr><tr><td>Server: </td><td>" . $_SERVER["HTTP_HOST"] . "</td></tr></table></body></html>";
         die;
         return null;
     }
     $values = $result->fetch_assoc();
     return Tenant::GetByAssoc($values);
 }