yf_manage_sites admin moduleCore sites management.
| File | plugins/sys/admin_modules/yf_manage_sites.class.php |
|---|---|
| Use | admin URL ?object=manage_sites |
| Property | Default | Description |
|---|---|---|
| None declared in this class. | ||
table | 'sites' |
public function active()
public function active()
{
return _class('admin_methods')->active(['table' => self::table]);
}
public function add()
public function add()
{
$a = null;
return form($a)
->validate([
'name' => 'trim|required',
])
->db_insert_if_ok(self::table, ['name', 'web_path', 'real_path'], [])
->on_after_update(function () {
cache_del([self::table]);
common()->admin_wall_add(['site added: ' . ($_POST['name'] ?? null) . '', db()->insert_id()]);
})
->text('name')
->text('web_path')
->text('real_path')
->active_box()
->save_and_back();
}
public function delete()
public function delete()
{
return _class('admin_methods')->delete(['table' => self::table]);
}
public function edit()
public function edit()
{
$a = db()->query_fetch('SELECT * FROM ' . db(self::table) . ' WHERE id=' . (int) (($_GET['id'] ?? null)));
if ( ! $a['id']) {
return _e('No id!');
}
$a = $_POST ? $a + $_POST : $a;
return form($a)
->validate([
'name' => 'trim|required',
])
->db_update_if_ok(self::table, ['name', 'web_path', 'real_path'], 'id=' . $a['id'])
->on_after_update(function () use ($a) {
cache_del([self::table]);
common()->admin_wall_add(['site updated: ' . ($_POST['name'] ?? null) . '', $a['id']]);
})
->text('name')
->text('web_path')
->text('real_path')
->active_box()
->save_and_back();
}
public function show()
public function show()
{
return table('SELECT * FROM ' . db(self::table))
->text('name')
->text('web_path')
->text('real_path')
->btn_active()
->btn_edit()
->btn_delete()
->footer_add();
}