本文整理汇总了PHP中Domain::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::find方法的具体用法?PHP Domain::find怎么用?PHP Domain::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
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');
}
}
示例2: getIndex
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');
}
}
示例3: showHome
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');
}
}
示例4: seoURL
public static function seoURL($domain_id, $lang = '')
{
$domain = Domain::find($domain_id);
$clean_chars = function ($string) {
$string = str_replace(' ', '-', $string);
// Replaces all spaces with hyphens.
$string = preg_replace('/[^A-Za-z0-9\\-]/', '', $string);
// Removes special chars.
return preg_replace('/-+/', '-', strtolower($string));
// Replaces multiple hyphens with single one.
};
$domain_name = self::formatDiacritics($clean_chars($domain->name));
if (empty($lang)) {
$lang = LaravelLocalization::getCurrentLocale();
}
return URL::route('domain.details', ['name' => $domain_name, 'id' => $domain->id]);
}
示例5: update
public function update(Request $request)
{
$id = $request->input('data.id');
$record = Record::find($id);
$record->name = $request->input('data.name');
$record->type = $request->input('data.type');
$record->content = $request->input('data.content');
$record->prio = $request->input('data.priority');
$record->ttl = $request->input('data.ttl');
$record->auth = "1";
$record->save();
$domain_id = $record->domain_id;
$type = $record->type;
if ($type == 'SOA') {
$zone = Domain::find($domain_id);
$zone->name = $request->input('data.name');
$zone->save();
}
return response()->json(['success' => 'record_updated'], 200);
}
示例6: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex()
{
$status = Auth::user()->status;
if ($status == 2) {
$online_phone = OnlinePhone::all();
} elseif ($status == 3) {
$domain = Domain::whereUserId(Auth::user()->id)->get(array('sip_server'));
$sip_server = array();
foreach ($domain as $row) {
$sip_server[] = $row['sip_server'];
}
if ($sip_server) {
$online_phone = OnlinePhone::whereIn('sip_server', $sip_server)->get();
} else {
$online_phone = [];
}
} else {
$sip_server = Domain::find(Cookie::get('domain_hash'))->sip_server;
$online_phone = OnlinePhone::whereSipServer($sip_server)->get();
}
return View::make('online_phone.index')->with('online_phones', $online_phone);
}
示例7: actionRefresh
public function actionRefresh()
{
$request = Yii::app()->getRequest();
$sid = trim($request->getParam("sid"));
if ($sid) {
try {
//获取url
$site = new Site();
$row = $site->find('sid=:sid', array(':sid' => $sid));
$domain = new Domain();
$row = $domain->find('id=:id', array(':id' => $row['dmid']));
$url = 'www.' . $row['name'];
//获取seo信息
$seo = new Seotool($url);
$info['alexa'] = (int) $seo->getAlexaRank();
$info['google'] = (int) $seo->getIndexedGoogle();
$info['baidu'] = (int) $seo->getIndexedBaidu();
$info['pr'] = (int) $seo->getPagerank();
$info['sid'] = $sid;
//更新数据
$res = new Seo();
$row = $res->find('sid=:sid', array(':sid' => $sid));
if ($row) {
$res = new Seo();
$res->_pk = $row['id'];
$res->_attributes = $info;
$res->setIsNewRecord(false);
$res->update();
} else {
$res = new Seo();
$res->_attributes = $info;
$res->insert();
}
$this->redirect(array('list'));
} catch (CDbException $e) {
throw CDbException($e);
}
}
}
示例8: route
$breadcrumbs->parent('category.list');
$breadcrumbs->push($category->name, route('category.details', $category->path));
$breadcrumbs->push(trans('directory.edit_category'), route('category.edit'));
});
// domains
Breadcrumbs::register('domain.list', function ($breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('directory.domains'), route('domain.list'));
});
Breadcrumbs::register('domain.create', function ($breadcrumbs) {
$breadcrumbs->parent('domain.list');
$breadcrumbs->push(trans('directory.add_domain'), route('domain.create'));
});
Breadcrumbs::register('domain.details', function ($breadcrumbs, $name, $id) {
$breadcrumbs->parent('domain.list');
$domain = Domain::find($id);
if (!empty($domain)) {
$breadcrumbs->push($domain->name, route('domain.details', $name));
}
});
Breadcrumbs::register('domains-pending', function ($breadcrumbs) {
$breadcrumbs->parent('domain.list');
$breadcrumbs->push(trans('directory.pending_domains'), route('domains-pending'));
});
Breadcrumbs::register('domain.user', function ($breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('user.my_websites'), route('domain.user'));
});
Breadcrumbs::register('domain.edit', function ($breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('directory.edit_domain'), route('domain.edit'));
示例9: domain_delete
public function domain_delete($p)
{
$d = Domain::find('first', array('conditions' => 'name = ' . Domain::quote($p->name)));
$d->destroy();
return true;
}
示例10: array
<?php
require_once 'base.php';
require_once $class_root . 'Record.php';
require_once $class_root . 'Domain.php';
print $display->header();
$default_key = $_GET['domain_id'] ? 'domain_id' : 'domain_name';
$d = null;
if (preg_match('/^\\d+$/', $_GET[$default_key])) {
$d = Domain::find('first', array('conditions' => 'id = ' . $_GET[$default_key]));
// $d = Domain::find($_GET[$default_key]);
} else {
$d = $_GET[$default_key];
}
?>
<script language="JavaScript" src="http://www.mattkruse.com/javascript/datadumper/datadumper.js"></script>
<script type="text/javascript">
function queue_record_add_all() {
$$('form').each(function(form) {
if(form.disabled == undefined) {
queue_record_add(form);
}
});
}
function queue_record_add(form) {
var myhash = new Hash();
示例11: getCreateComment
public function getCreateComment($domain_id)
{
$domain = Domain::find($domain_id);
return View::make('comments.create', compact('domain'));
}
示例12: getDelete
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function getDelete($id)
{
$domain = Domain::find($id);
$domain->delete();
$user = User::whereDomainId($id)->first();
if ($user) {
$user->delete();
$phone_number = PhoneNumber::whereUserId($user->id)->first();
$phone_number->delete();
Event::fire('logger', array(array('phone_number_remove', array('id' => $phone_number->id, 'extension' => $phone_number->extension), 2)));
}
Event::fire('logger', array(array('domain_remove', array('id' => $id, 'domain_name' => $domain->domain), 2)));
return Output::push(array('path' => 'domain', 'messages' => array('success' => _('Domain has been deleted'))));
}
示例13: vars
require_once $class_root . 'Domain.php';
require_once $class_root . 'Record.php';
$rowamount = (int) $config->get('iface.rowamount');
# Get input vars (or set to some default)
$offset = isset($_GET["start"]) ? ($_GET["start"] - 1) * $rowamount : 0;
$start = isset($_GET["start"]) ? $_GET["start"] : 1;
$domain_id = isset($_GET['id']) ? $_GET['id'] : 0;
print $display->header();
# Input validation
if (!preg_match('/^\\d+$/', $domain_id) || !preg_match('/^\\d+$/', $offset) || !preg_match('/^\\d+$/', $start)) {
print $display->error("You hacker!");
print $display->footer();
exit(1);
}
try {
$d = Domain::find($domain_id);
$result = ActiveRecord::query("SELECT COUNT(*) AS count FROM records WHERE domain_id={$d->id}");
$rCount = (int) $result[0]['count'];
if ($rCount > $rowamount) {
$findResult = Record::find('all', array('limit' => "{$rowamount}", 'offset' => "{$offset}", 'conditions' => 'domain_id = ' . Record::quote($d->id), 'order' => 'name'));
} else {
$findResult = Record::find('all', array('conditions' => 'domain_id = ' . Record::quote($d->id), 'order' => 'name'));
}
} catch (Exception $e) {
print $e->getMessage();
print $display->footer();
exit(0);
}
print sprintf('<div class="header">%s records found for domain %s</div><br>', $rCount, $d->name);
print $display->link('record_add.php?domain_id=' . $d->id, 'Add record');
print "<br>";
示例14: getEdit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function getEdit($id, $c_id = null)
{
$data['global_prefix'] = Config::get('settings.global_prefix');
$data['domain'] = $c_id ? Domain::find($id) : Domain::find(Auth::user()->domain_id);
$data['phone_number'] = $c_id ? PhoneNumber::find($c_id) : PhoneNumber::find($id);
if (Request::segment(2) == "manage") {
foreach (User::whereDomainId(Request::segment(3))->get() as $row) {
$data['users'][$row['id']] = $row['username'];
}
}
return View::make('phone_number.edit')->with('data', $data);
}
示例15: function
if (Auth::guest()) {
return Redirect::guest('login');
}
});
Route::filter('auth.basic', function () {
return Auth::basic();
});
Route::filter('auth.admin', function () {
if (Auth::user()->status != 2) {
return Redirect::to('dashboard');
}
});
Route::filter('auth.manager', function () {
if (Request::segment(4) && Request::segment(4) != 'search') {
if (Auth::user()->status != 2) {
$domain = Domain::find(Request::segment(4))->where('user_id', Auth::user()->id)->get();
if (count($domain) <= 0) {
return Redirect::to('dashboard');
}
}
}
if (Auth::user()->status != 3 && Auth::user()->status != 2) {
return Redirect::to('dashboard');
}
});
Route::filter('phone_number', function () {
if (Auth::user()->status != 4 && Request::segment(2) != 'manage') {
return Redirect::to('dashboard');
}
});
/*