Ejemplo n.º 1
0
function moveToClient()
{
    global $gbl, $sgbl, $login, $ghtml;
    $login->loadAllObjects('ftpuser');
    $l = $login->getList('ftpuser');
    foreach ($l as $b) {
        if (csb($b->parent_clname, 'web-')) {
            list($parentclass, $parentname) = getParentNameAndClass($b->parent_clname);
            $d = new Domain(null, null, $parentname);
            $d->get();
            $b->parent_clname = $d->parent_clname;
            $w = $d->getObject('web');
            $b->directory = "{$w->docroot}/{$b->directory}";
            $b->directory = remove_extra_slash($b->directory);
            $b->setUpdateSubaction();
            $b->write();
        }
    }
    $login->loadAllObjects('mysqldb');
    $l = $login->getList('mysqldb');
    foreach ($l as $b) {
        if (csb($b->parent_clname, 'domain-')) {
            list($parentclass, $parentname) = getParentNameAndClass($b->parent_clname);
            $d = new Domain(null, null, $parentname);
            $d->get();
            $b->parent_clname = $d->parent_clname;
            $b->setUpdateSubaction();
            $b->write();
        }
    }
}
Ejemplo n.º 2
0
 /**
  * @param string $emailAddress
  * @return mixed if true integer otherwise null
  */
 public static function saveEmailAddress($emailAddress)
 {
     $emailID = null;
     $parseEmail = explode('@', strtolower(trim($emailAddress)));
     if (count($parseEmail) == 2) {
         $domain = Domain::model()->findByAttributes(array('name' => $parseEmail[1]));
         if (!$domain) {
             $domain = new Domain();
             $domain->name = $parseEmail[1];
         }
         if ($domain->save()) {
             $email = new Email();
             $email->username = $parseEmail[0];
             $email->domainID = $domain->ID;
             if ($email->save()) {
                 $emailID = $email->ID;
             } else {
                 if ($domain->isNewRecord) {
                     Domain::model()->deleteByPk($domain->ID);
                 }
             }
         }
     }
     return $emailID;
 }
Ejemplo n.º 3
0
 function deleteAction()
 {
     $id = AF::get($_POST, 'id', 0);
     $modelsID = explode(',', $id);
     $errors = FALSE;
     foreach ($modelsID as $id) {
         $model = new Domain();
         //$model->model_uset_id = $this->user->user_id;
         if ($model->findByPk($id)) {
             // if beforeDelete() returns an error, indicate this to the user
             if (!$model->delete($id)) {
                 $errors = TRUE;
             }
         } else {
             $errors = TRUE;
         }
         if ($model->getErrors()) {
             $errors = TRUE;
         }
         unset($model);
     }
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         if ($errors) {
             Message::echoJsonError(__('domain_not_deleted'));
         } else {
             Message::echoJsonSuccess(__('domain_deleted'));
         }
     }
     $this->redirect();
 }
Ejemplo n.º 4
0
 public static function AddDomain($uDomain)
 {
     global $sUser;
     global $sDefaultIP;
     global $user_ssh;
     global $user_sftp;
     global $database;
     // Filter Domain
     $uDomain = preg_replace("/[^a-z0-9_ .-]/i", "", $uDomain);
     $uDomain = str_replace("www.", "", $uDomain);
     $sDomain = str_replace("http://", "", $uDomain);
     $result = $database->CachedQuery("SELECT * FROM domains WHERE `domain_name` = :Domain", array(':Domain' => $sDomain), 5);
     if (empty($result)) {
         // Validate path information
         $sUser->sRootDir = '/home/' . $sUser->sUsername . '/';
         $sValidate = new PathValidator($sUser->sRootDir . $sDomain);
         if ($sValidate->ValidatePath($sUser->sRootDir)) {
             // Connect to server
             if (!$user_ssh->login($sUser->sUsername, $_SESSION['password'])) {
                 exit('User Connection To Server Failed!');
             }
             if (!$user_sftp->login($sUser->sUsername, $_SESSION['password'])) {
                 exit('User Connection To Server Failed!');
             }
             // Create folders for domain & logs
             $sPublic = $sUser->sRootDir . $sDomain . "/public_html/";
             $sLogs = $sUser->sRootDir . "/logs/";
             $sCreateFolder = $user_ssh->exec("mkdir " . escapeshellarg($sUser->sRootDir . $sDomain) . ";mkdir " . escapeshellarg($sPublic) . ";mkdir " . escapeshellarg($sLogs) . ";");
             // Generate configs
             $sReplace = array("domain_name" => $sDomain, "username" => $sUser->sUsername);
             $sConfig = file_get_contents('./includes/configs/nginx.default.conf');
             foreach ($sReplace as $key => $value) {
                 $sConfig = str_replace($key, $value, $sConfig);
             }
             $sFileContent = $user_sftp->put('/etc/nginx/sites-enabled/' . $sDomain . '.conf', $sConfig);
             $sTestConfig = $user_ssh->exec("nginx -t -c /etc/nginx/nginx.conf");
             if (strpos($sTestConfig, 'failed') !== false) {
                 $sDeleteConfig = $user_ssh->exec("rm -rf /etc/nginx/sites-enabled/" . $sDomain . ".conf");
                 die("Seems to be a problem setting up the config.");
             }
             $sReload = $user_ssh->exec("/etc/init.d/nginx reload");
             $sReload = $user_ssh->exec("/etc/init.d/pdns reload");
             // Insert Domain Into Database
             $sCreateDomain = new Domain(0);
             $sCreateDomain->uName = $uDomain;
             $sCreateDomain->uOwner = $sUser->sId;
             $sCreateDomain->uActive = 1;
             $sCreateDomain->InsertIntoDatabase();
             // Add DNS Records
             $sResultOne = $database->CachedQuery("INSERT INTO dns.domains (name, type) VALUES(:Domain, 'NATIVE')", array(':Domain' => $sDomain));
             $sDomainId = $database->lastInsertId();
             $sResultTwo = $database->CachedQuery("INSERT INTO dns.records (domain_id, name, content, type, ttl, prio) VALUES(:Id, :Domain, :IPAddress, 'A', '120', 'NULL')", array(':Id' => $sDomainId, ':Domain' => $sDomain, ':IPAddress' => $sDefaultIP->sValue));
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 5
0
 private function saveDomain($domain, $grade, $image)
 {
     $model = new Domain();
     $model->domain = $domain;
     $model->image = $image . '.png';
     $model->grade = $grade;
     $model->save(false);
 }
Ejemplo n.º 6
0
 /**
  * Helper to set results for all the users on a domain to a specific value
  *
  * @param array $users    Array of users (usernames)
  * @param Domain $domain   The domain
  * @param int $val      Value to set 1 or 0 ( Valid,Invalid )
  * @param String $info  Optional , can be used to give additional information about the result
  */
 public function setDomainResults($users, Domain $domain, $val, $info = '')
 {
     if (!is_array($users)) {
         $users = (array) $users;
     }
     foreach ($users as $user) {
         $this->results[$user . '@' . $domain->getDomain()] = array('result' => $val, 'info' => $info);
     }
 }
 public function OnDomainCreated(Domain $domain)
 {
     if ($domain->IsManagedDNSEnabled) {
         $userinfo = $this->DB->GetRow("SELECT * FROM users WHERE id=?", array($domain->UserID));
         $SOA_owner = str_replace("@", ".", $userinfo["email"]);
         $this->DB->Execute("INSERT INTO zones (\t`zone`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_owner`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_ttl`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_parent`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_serial`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_refresh`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_retry`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`soa_expire`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`min_ttl`, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`isupdated`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t   )\r\n\t    \t\t\t\t\t\t\t\t VALUES (?,?,'14400',?,?,'14400','7200','3600000','86400',0)", array($domain->GetHostName(), $SOA_owner, CONFIG::$NS1, date("Ymd") . "01"));
         $zoneid = $this->DB->Insert_ID();
         $this->DB->Execute("INSERT INTO records (id, zoneid, rtype, ttl, rpriority, rvalue, rkey) \r\n\t\t\t\t\t\t\t  SELECT null, '{$zoneid}', rtype, ttl, rpriority, rvalue, rkey FROM records \r\n\t\t\t\t\t\t\t  WHERE zoneid='0'\r\n\t\t\t\t\t\t\t ");
     }
 }
Ejemplo n.º 8
0
 public function save()
 {
     try {
         $model = new Domain();
         $this->data->domain->entry = 'dom_' . $this->data->domain->entry;
         $model->setData($this->data->domain);
         $model->save();
         $this->renderPrompt('information', 'OK', "editEntry('{$this->data->domain->entry}');");
     } catch (\Exception $e) {
         $this->renderPrompt('error', $e->getMessage());
     }
 }
Ejemplo n.º 9
0
 public function webpage_select($domain_id)
 {
     //取出domain list
     $this->load->library('kals_resource/Domain');
     $all_domains = $this->domain->find_all();
     $domain = new Domain($domain_id);
     $all_webpages = $domain->get_webpages();
     $title = 'webpage_select';
     $this->load->view('admin_apps/header', array('title' => $title));
     $this->load->view('admin_apps/domain_select', array('all_domains' => $all_domains, 'selected_domain' => $domain));
     $this->load->view('admin_apps/webpage_select', array('all_webpages' => $all_webpages));
     $this->load->view('admin_apps/footer');
 }
Ejemplo n.º 10
0
 function getHTML($id)
 {
     $U = new mUserdata();
     $U = $U->getUDValue("selectedDomain");
     if ($U == null) {
         $t = new HTMLTable(1);
         $t->addRow("Sie haben keine Domain ausgewählt.<br /><br />Bitte wählen Sie eine Domain im Domain-Plugin, indem Sie auf das graue Kästchen in der Liste auf der rechten Seite klicken.");
         return $t->getHTML();
     }
     $Domain = new Domain($U);
     $Domain->loadMe();
     $variables = array("domainTemplate", "contentTemplate", "naviTemplate", "pageTemplate");
     $variables["domainTemplate"] = array("TITLE", "DESCRIPTION", "NAVIGATION", "HEADER", "PAGE");
     $variables["contentTemplate"] = array("TEXT", "IMAGE", "DOWNLOADS", "CONTENTID", "HANDLER");
     $variables["naviTemplate"] = array("LINK", "URL", "TEXT");
     $variables["pageTemplate"] = array("HEADER", "CONTENT", "DOMAIN");
     $variables["dlTemplate"] = array("TEXT", "DOWNLOADS");
     #$this->setParser("html","Util::base64Parser");
     if ($this->A == null and $id != -1) {
         $this->loadMe();
     }
     if ($id == -1) {
         $this->A = $this->newAttributes();
     }
     $gui = new HTMLGUI();
     $gui->setObject($this);
     $gui->setName("Template");
     $TG = new TemplatesGUI();
     $options = $TG->getAvailableCategories();
     $gui->setType("templateType", "select");
     $gui->setOptions("templateType", array_keys($options), array_values($options));
     $gui->setInputJSEvent("templateType", "onchange", "CMSTemplate.updateVariables(this);");
     $gui->setInputJSEvent("templateType", "onkeyup", "CMSTemplate.updateVariables(this);");
     $gui->setLabel("templateType", "Typ");
     $gui->setType("html", "TextEditor64");
     $gui->setType("TemplateDomainID", "radio");
     $gui->setLabel("TemplateDomainID", "Domain");
     $gui->setOptions("TemplateDomainID", array("0", $U), array("alle", "nur " . $Domain->getA()->title));
     $gui->hideAttribute("TemplateID");
     $gui->setType("aktiv", "hidden");
     $gui->setStandardSaveButton($this, "Templates");
     $vars = "";
     foreach ($variables as $k => $v) {
         if (is_array($variables[$k])) {
             $vars .= "<p id=\"{$k}Variables\" style=\"" . ($this->A->templateType == $k ? "" : "display:none;") . "\">%%%" . implode("%%%<br />%%%", $variables[$k]) . "%%%</p>";
         }
     }
     $html = "\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\tnew Draggable('TBVarsContainer',{handle:'TBVarsHandler', zindex: 2000});\n\t\t\t\toldVarSelected = '" . ($this->A->templateType != null ? $this->A->templateType : "null") . "';\n\t\t\t</script>\n\t\t\t<div \n\t\t\t\tstyle=\"position:absolute;z-index:2000;left:450px;width:200px;border-width:1px;border-style:solid;" . (isset($variables[$this->A->templateType]) ? "" : "display:none;") . "\"\n\t\t\t\tclass=\"backgroundColor0 borderColor1\"\n\t\t\t\tid=\"TBVarsContainer\"\n\t\t\t>\n\t\t\t<div class=\"cMHeader backgroundColor1\" id=\"TBVarsHandler\">Variablen:</div>\n\t\t\t<div>\n\t\t\t\t<p><small>Sie können folgende Variablen in Ihrem HTML verwenden (bitte beachen Sie Groß- und Kleinschreibung):</small></p>\n\t\t\t\t{$vars}\n\t\t\t</div>\n\t\t\t</div>";
     return $html . $gui->getEditHTML();
 }
Ejemplo n.º 11
0
function doEdit()
{
    if (isset($_POST['submit'])) {
        $domain_id = $_POST['domain_id'];
        $domainname = $_POST['domainname'];
        $description = $_POST['description'];
        $sector = $_POST['psector'];
        $domain = new Domain();
        $domain->domain_id = $domain_id;
        $domain->domain_name = $domainname;
        $domain->description = $description;
        $domain->sector_id = $sector;
    }
    if ($domain_id == "") {
        message('Domain ID is required!', "error");
        redirect('index.php?view=edit&id=' . $domain_id);
    } elseif ($domainname == "") {
        message('Domain Name is required!', "error");
        redirect('index.php?view=edit&id=' . $domain_id);
    } elseif ($description == "") {
        message('Description is required!', "error");
        redirect('index.php?view=edit&id=' . $domain_id);
    } elseif ($sector == "") {
        message('Sector is required!', "error");
        redirect('index.php?view=edit&id=' . $domain_id);
    } else {
        $domain->update($_GET['id']);
        message('Domain infomation updated successfully!', "info");
        redirect('index.php');
    }
}
Ejemplo n.º 12
0
 public static function byDomain($domain)
 {
     if (Domain::is($domain)) {
         return self::$DOMAIN_LAYOUTS[$domain];
     }
     return self::DEFAULT_LAYOUT;
 }
Ejemplo n.º 13
0
 public function dcp()
 {
     $domain = Domain::whereDomain(Request::getHttpHost())->first();
     //$domain = Domain::whereDomain(Request::server("SERVER_NAME"))->first();
     $cookie = Cookie::make('domain_hash', $domain->id);
     return Redirect::to('/')->withCookie($cookie);
 }
Ejemplo n.º 14
0
 /**
  * Discard all entities matching the supplied criterion.
  * 
  * @param ICriterion $Criterion The criterion to discard by
  */
 public function DiscardWhere(ICriterion $Criterion)
 {
     if (!$this->Domain->HasEntityMap($Criterion->GetEntityType())) {
         throw $this->TypeMismatch('criterion', $Criterion->GetEntityType());
     }
     $this->DiscardedCriteria[spl_object_hash($Criterion)] = $Criterion;
 }
 /**
  * Executor
  *
  * @throws UpdateDomainContactTask_Exception
  */
 public function Run($userid = null)
 {
     try {
         $Factory = RegistryModuleFactory::GetInstance();
         $Registry = $Factory->GetRegistryByExtension($this->Domain->Extension);
         $Manifest = $Registry->GetManifest();
         if ($userid && $this->Domain->UserID != $userid) {
             throw new UpdateDomainContactAction_Exception(_("You don't have permissions for manage this domain"), UpdateDomainContactAction_Exception::DOMAIN_NOT_BELONGS_TO_USER);
         }
         $OldContact = $this->Domain->GetContact($this->contact_type);
         if ($this->NewContact && $this->NewContact->UserID != $this->Domain->UserID) {
             throw new UpdateDomainContactAction_Exception(_("You don't have permissions for using this contact"), UpdateDomainContactAction_Exception::CONTACT_NOT_BELONGS_TO_USER);
         }
         $trade = $Manifest->GetRegistryOptions()->ability->trade == '1';
         if ($this->contact_type != CONTACT_TYPE::REGISTRANT || !$trade) {
             try {
                 $Registry->UpdateDomainContact($this->Domain, $this->contact_type, $OldContact, $this->NewContact);
                 return $this->Domain->HasPendingOperation(Registry::OP_UPDATE) ? UpdateDomainContactAction_Result::PENDING : UpdateDomainContactAction_Result::OK;
             } catch (Exception $e) {
                 throw new UpdateDomainContactAction_Exception(sprintf(_("Cannot change contact. Reason: %s"), $e->getMessage()));
             }
         } else {
             // Execute trade when:
             // - Trade invoice is paid
             // - Previous trade failed
             if ($this->Domain->IncompleteOrderOperation == INCOMPLETE_OPERATION::DOMAIN_TRADE || $this->Invoice && $this->Invoice->Status == INVOICE_STATUS::PAID) {
                 $this->Domain->SetContact($this->NewContact, CONTACT_TYPE::REGISTRANT);
                 $this->Domain->IncompleteOrderOperation = null;
                 $extra["requesttype"] = "ownerChange";
                 try {
                     $trade = $Registry->ChangeDomainOwner($this->Domain, 1, $extra);
                     return $this->Domain->HasPendingOperation(Registry::OP_TRADE) ? UpdateDomainContactAction_Result::PENDING : UpdateDomainContactAction_Result::OK;
                 } catch (Exception $e) {
                     $this->Domain->IncompleteOrderOperation = INCOMPLETE_OPERATION::DOMAIN_TRADE;
                     if ($this->Invoice) {
                         $this->Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED;
                         $this->Invoice->ActionFailReason = $e->getMessage();
                     }
                     throw new UpdateDomainContactAction_Exception(sprintf(_("Cannot change contact. Reason: %s"), $e->getMessage()));
                 }
             } else {
                 // Issue an invoice for trade operation
                 $invoiceid = $this->Db->GetOne("SELECT * FROM invoices WHERE status=? AND itemid=? AND purpose=?", array(INVOICE_STATUS::PENDING, $this->Domain->ID, INVOICE_PURPOSE::DOMAIN_TRADE));
                 if (!$invoiceid) {
                     $this->Domain->SetExtraField("NewRegistrantCLID", $this->NewContact->CLID);
                     DBDomain::GetInstance()->Save($this->Domain);
                     $Invoice = new Invoice(INVOICE_PURPOSE::DOMAIN_TRADE, $this->Domain->ID, $userid);
                     $Invoice->Description = sprintf(_("%s domain name trade"), $this->Domain->GetHostName());
                     $Invoice->Save();
                     $this->Invoice = $Invoice;
                     return UpdateDomainContactAction_Result::INVOICE_GENERATED;
                 } else {
                     throw new UpdateDomainContactAction_Exception(_("Another domain trade is already initiated"));
                 }
             }
         }
     } catch (Exception $e) {
         throw new UpdateDomainContactAction_Exception($e->getMessage());
     }
 }
Ejemplo n.º 16
0
 public function attemptDetails($id)
 {
     $attempt = Attempt::find($id);
     $category = Category::find($attempt->category_id) ? Category::find($attempt->category_id)->name : 'N/A';
     $similar_domains = Domain::where('url', 'LIKE', '%' . $attempt->url . '%')->get();
     return View::make('admin.attempt_details')->with(compact('attempt', 'category', 'similar_domains'));
 }
Ejemplo n.º 17
0
 private function _build()
 {
     $deploy = $this->_get_deploy();
     // get domains
     $domains = array();
     foreach ($deploy->{'domains'} as $d) {
         $domain = Domain::fromJson($d);
         $domains[$domain->getId()] = $domain;
         Logger::debug("load domain %s", $domain->toString());
     }
     // get layers
     foreach ($deploy->{'layers'} as $l) {
         $domain = $domains[$l->{'domain_id'}];
         $layer = new Layer($l->{'id'}, $domain);
         $this->_layers[$l->{'id'}] = $layer;
         Logger::debug("load layer %s", $layer->toString());
     }
     // assign experiments
     foreach ($deploy->{'experiments'} as $e) {
         $exp = Experiment::fromJson($e);
         $this->_exps[$exp->getId()] = $exp;
         $layer = $this->_layers[$exp->getLayerId()];
         $layer->assign($exp);
         Logger::debug("load exp %s", $exp->toString());
     }
     foreach ($deploy->{'parameters'} as $p) {
         $param = Parameter::fromJson($p);
         $this->_baseParams[$param->getName()] = $param->getValue();
         Logger::debug("load param %s => %s", $param->getName(), $param->getValue());
     }
 }
Ejemplo n.º 18
0
    public function searchAjax()
    {
        $response = '';
        $search_term = trim(e(Input::get('search_term')));
        $domains = Domain::where('status', 1)->where('name', 'LIKE', '%' . $search_term . '%')->orWhere('url', 'LIKE', '%' . $search_term . '%')->orWhere('description', 'LIKE', '%' . $search_term . '%')->take(5)->get(['id', 'name', 'thumb']);
        if (count($domains)) {
            foreach ($domains as $domain) {
                $domain_name = strlen($domain->name) > 30 ? substr($domain->name, 0, 30) . '...' : $domain->name;
                $response .= '<div class="search-box">
					<a class="search-result-row" href="' . Domain::seoURL($domain->id) . '">
						<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
							<img class="img img-responsive thumbnail" 
								src="' . URL::asset('assets/thumbs/' . $domain->thumb) . '" alt="site preview" />
						</div>			
						<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
							' . $domain_name . '	
						</div>	
						<div class="clearfix"></div>
					</a>	
					</div>';
            }
        } else {
            $response .= '<p>' . Lang::get('general.no_results', ['serch_term' => $search_term]) . '</p>';
        }
        print $response;
    }
Ejemplo n.º 19
0
 public function getIndex()
 {
     if (Cookie::get('domain_hash') && Domain::find(Cookie::get('domain_hash'))->allow_registration == 0) {
         return Redirect::to('login');
     } else {
         return View::make('register.index');
     }
 }
Ejemplo n.º 20
0
 public static function insertSkipDupes($domains)
 {
     $query = sprintf('INSERT INTO domains (name) VALUES ("%s") ON DUPLICATE KEY UPDATE name=name', implode('"),("', $domains));
     $status = DB::statement($query);
     Domain::where('created_at', '0000-00-00 00:00:00')->update(['created_at' => DB::raw('NOW()')]);
     Domain::where('created_at', '0000-00-00 00:00:00')->update(['updated_at' => DB::raw('NOW()')]);
     return $status;
 }
Ejemplo n.º 21
0
 public static function getThemesListData()
 {
     if (null === self::$themes) {
         $themes = array_diff(array_map('basename', glob(Yii::app()->themeManager->basePath . '/*', GLOB_ONLYDIR)), array());
         self::$themes = array_combine($themes, array_map('ucfirst', $themes));
     }
     return self::$themes;
 }
Ejemplo n.º 22
0
 public function copy(Domain $domain)
 {
     $this->defaultValue = $domain->getDefaultValue();
     $this->description = $domain->getDescription();
     $this->name = $domain->getName();
     $this->scale = $domain->getScale();
     $this->size = $domain->getSize();
     $this->sqlType = $domain->getSqlType();
     $this->propelType = $domain->getType();
 }
Ejemplo n.º 23
0
 public function test__DomainGetexttlds__returnResults()
 {
     $result = Domain::domain_Getexttlds();
     if ($result['content']['success'] == true) {
         $count = $result['content']['data']['total_count'];
         $expected = count($result['content']['data']) - 1;
         $this->assertEquals($count, $expected);
     }
 }
Ejemplo n.º 24
0
 public function listUserDomains()
 {
     $has_domains = count(Acl::getAdminEntitiesIDs('Domain'));
     if (!empty($has_domains)) {
         $user_domains = Domain::whereIn('id', Acl::getAdminEntitiesIDs('Domain'))->paginate(8);
         return View::make('user.domains')->with(compact('user_domains'));
     }
     return View::make('user.account')->with('error', 'Nu ai nici un site inscris!');
 }
Ejemplo n.º 25
0
 protected function loadDomain()
 {
     if (null !== ($model = Domain::model()->findByAttributes(array('name' => Yii::app()->request->serverName)))) {
         Yii::app()->getParams()->mergeWith($model->attributes);
     } else {
         $model = new Domain();
         Yii::app()->getParams()->mergeWith($model->attributes);
     }
 }
Ejemplo n.º 26
0
 public function getIndex()
 {
     if (Cookie::get('domain_hash')) {
         $domain = Domain::find(Cookie::get('domain_hash'));
         $homepage = $domain->homepage ? $domain->homepage : $domain->domain;
         return View::make('dashboard.index')->withHomepage($homepage);
     } else {
         return View::make('dashboard.index');
     }
 }
Ejemplo n.º 27
0
 /**
  * Получение модели домена
  * @return Domain
  * @throws CException
  */
 public function getModel()
 {
     if ($this->_model === null) {
         $this->_model = Domain::model()->findByPk($this->mainDomainId);
     }
     if ($this->_model === null) {
         throw new CException('Домен с id = ' . $this->mainDomainId . ' не найден.');
     }
     return $this->_model;
 }
Ejemplo n.º 28
0
 private function FixTransferLonelyFlag(Domain $Domain, Changelist $Changes)
 {
     $added = $Changes->GetAdded();
     $removed = $Changes->GetRemoved();
     if (count($added) + count($removed) < 2 && in_array('clientTransferProhibited', array_merge($added, $removed))) {
         // Add flag that is presented in domain and not will be removed at this time
         $candidates = array_diff($Domain->GetFlagList(), $removed);
         if ($candidates) {
             $added[] = array_shift($candidates);
         } else {
             // Remove flag that not presented in domain and not will be added at this time
             $candidates = array_diff($this->epp_flags, $Domain->GetFlagList(), $added);
             if ($candidates) {
                 $removed[] = array_shift($candidates);
             }
         }
     }
     return array($added, $removed);
 }
Ejemplo n.º 29
0
 public function showHome()
 {
     if (Cookie::get('domain_hash')) {
         $domain = Domain::find(Cookie::get('domain_hash'));
         $homepage = $domain->homepage ? $domain->homepage : $domain->domain;
         return View::make('home')->withHomepage($homepage);
     } else {
         return View::make('home');
     }
 }
 public function actionAdminView($id)
 {
     $model = DomainSuggestion::model()->findByPk($id);
     if (strcasecmp($model->status, "pending") == 0) {
         if (isset($_POST['button1'])) {
             $model->status = "Accepted";
             $model->description = $_POST['DomainSuggestion']['description'];
             $domainID = $_POST['DomainSuggestion']['Domain'];
             $dom = Domain::model()->findByPk($domainID);
             if (is_null($dom)) {
                 $dom = new Domain();
                 $dom->name = $model->name;
                 $dom->description = $model->description;
                 $dom->need = "Medium";
                 $dom->need_amount = 5;
                 $dom->validator = 5;
                 $dom->save();
             } else {
                 $subDom = new Subdomain();
                 $subDom->need = "Medium";
                 $subDom->name = $model->name;
                 $subDom->description = $model->description;
                 $subDom->validator = 5;
                 $subDom->need_amount = 5;
                 $subDom->domain_id = $dom->id;
                 $subDom->save();
             }
             if ($model->save()) {
                 $this->redirect(array('view', 'id' => $model->suggestion_id));
             }
         }
         if (isset($_POST['button2'])) {
             $model->status = "Rejected";
             if ($model->save()) {
                 $this->redirect(array('view', 'id' => $model->suggestion_id));
             }
         }
         $this->render('adminView', array('model' => $model));
     } else {
         $this->actionView($id);
     }
 }