remove widget html_only, add widget html_php_card

This commit is contained in:
iBNu Maksum
2025-03-04 16:14:10 +07:00
parent 3b7d478635
commit 8429ed763e
7 changed files with 546 additions and 20 deletions

View File

@ -39,8 +39,7 @@ if ($action == 'add') {
$enabled = alphanumeric($_POST['enabled']);
$title = _post('title');
$widget = _post('widget');
$content = _post('content');
print_r($_POST);
$d = ORM::for_table('tbl_widgets')->create();
$d->orders = $orders;
$d->position = $position;
@ -48,7 +47,7 @@ if ($action == 'add') {
$d->enabled = $enabled;
$d->title = $title;
$d->widget = $widget;
$d->content = $content;
$d->content = _post('content');
$d->save();
if ($d->id() > 0) {
r2(getUrl('widgets&user=' . $tipeUser), 's', 'Widget Added Successfully');
@ -79,8 +78,6 @@ if ($action == 'add') {
$enabled = alphanumeric($_POST['enabled']);
$title = _post('title');
$widget = _post('widget');
$content = _post('content');
$d = ORM::for_table('tbl_widgets')->find_one($id);
$d->orders = $orders;
$d->position = $position;
@ -88,7 +85,7 @@ if ($action == 'add') {
$d->enabled = $enabled;
$d->title = $title;
$d->widget = $widget;
$d->content = $content;
$d->content = _post('content');
$d->save();
r2(getUrl('widgets&user=' . $tipeUser), 's', 'Widget Saved Successfully');
}

View File

@ -1116,5 +1116,8 @@
"Reminder_Notification_Intervals": "Reminder Notification Intervals",
"Reminder_Notify_Intervals": "Reminder Notify Intervals",
"read_documentation": "read documentation",
"Day": "Day"
"Day": "Day",
"Delete_this_widget_": "Delete this widget?",
"Remove_this_widget_": "Remove this widget?",
"PPPoE_Remote_IP": "PPPoE Remote IP"
}

View File

@ -1,11 +0,0 @@
<?php
class html_only
{
public function getWidget($data = null)
{
global $ui;
return $data['content'];
}
}

View File

@ -16,7 +16,6 @@ class html_php
echo $e->getTraceAsString();
}
$content = ob_get_clean();
$ui->assign('card_body', $content);
return $ui->fetch('widget/card_html.tpl');
return $content;
}
}

View File

@ -0,0 +1,22 @@
<?php
class html_php
{
public function getWidget($data = null)
{
global $ui;
$ui->assign('card_header', $data['title']);
ob_start();
try{
eval('?>'. $data['content']);
}catch(Exception $e){
echo $e->getMessage();
echo "<br>";
echo $e->getTraceAsString();
}
$content = ob_get_clean();
$ui->assign('card_body', $content);
return $ui->fetch('widget/card_html.tpl');
}
}