/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Device(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Device'])) { $model->attributes = $_POST['Device']; $model->status = 1; if (Person::model()->findByPk($model->person_id)->company_id == User::getMyCompany() || Yii::app()->user->role == 1) { if ($model->save()) { $fp = fopen('images/barcode/' . $model->barcode . '.png', 'wb'); // Открываем файл $ch = curl_init("http://barcode.tec-it.com/barcode.ashx?translate-esc=off&data={$model->barcode}&code=Code128&unit=Fit&dpi=96&imagetype=Png&rotation=0&color=000000&bgcolor=FFFFFF&qunit=Mm&quiet=0"); curl_setopt($ch, CURLOPT_FILE, $fp); // Передаём дескриптор файла, туда сбросится результат curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); //Перечмодим файлик chmod('images/barcode/' . $model->barcode . '.png', 0777); //Теперь мы его обрежем, чтобы не нам не мешал водознак UserFunctions::crop('images/barcode/' . $model->barcode . '.png'); $this->redirect(array('view', 'id' => $model->id)); } } else { throw new CHttpException(403, 'Вы не имеете прав в этой организации'); } } $this->render('create', array('model' => $model)); }
public function actionLoginApi($uid, $planet, $ver = NULL, $token = NULL) { $transaction = Yii::app()->db->beginTransaction(); try { $device = Device::model()->findByAttributes(array('uid' => $uid)); $isSuccess = true; $session = Yii::app()->session; if (empty($device->usr_id)) { if ($device === NULL) { $device = new Device(); $device->uid = $uid; //$device->token = $token; $device->create_time = time(); $device->save(); } $session['id'] = $device->id; $session['not_registered'] = TRUE; $isSuccess = false; } else { $session['usr_id'] = $device->usr_id; $user = User::model()->findByAttributes(array('usr_id' => $device->usr_id)); $user->login(); } $session['planet'] = $planet; $device->sid = $session->sessionID; $device->saveAttributes(array('sid')); $transaction->commit(); $this->echoJsonData(array('isSuccess' => $isSuccess, 'usr_id' => $device->usr_id, 'SID' => $session->sessionID)); } catch (Exception $e) { $transaction->rollback(); throw $e; } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionTambah() { $model = new Device(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Device'])) { $model->attributes = $_POST['Device']; if ($model->save()) { $this->redirect(array('ubah', 'id' => $model->id)); } } $this->render('tambah', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Device(); $modelsBrands = Brand::model()->findAll(); $brandsArray = CHtml::listData($modelsBrands, 'id', 'brand_name'); $modelsPlatforms = Platforms::model()->findAll(); $platformsArray = CHtml::listData($modelsPlatforms, 'id', 'name'); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['buttonCancel'])) { $this->redirect(array('admin')); } if (isset($_POST['Device'])) { $model->attributes = $_POST['Device']; /*GARENTE QUE O NOME DO DEVICE SEMPRE SEJA SALVO EM MAIÚSCULO*/ $model->description = strtoupper($model->description); if ($model->save()) { $this->redirect(array('admin', 'id' => $model->id)); } } $this->render('create', array('model' => $model, 'brandsArray' => $brandsArray, 'platformsArray' => $platformsArray)); }
public function beat() { $data = Input::all(); // return EndorphinHelpers::apiResponse(EndorphinHelpers::STATUS_SUCCESS, $data['data']); if (is_null($data)) { return EndorphinHelpers::apiResponse(EndorphinHelpers::STATUS_ERROR, array('item' => 'data')); } if (is_null($data['phone_imei'])) { return EndorphinHelpers::apiResponse(EndorphinHelpers::STATUS_ERROR, array('item' => 'phone_imei')); } $heartbeat = new Heartbeat($data); $heartbeat->save(); $device = Device::with(array('users' => function ($query) { $query->where('device_user.user_id', '=', Auth::user()->id); }, 'heartbeats' => function ($query) { }))->where('hardware_id', '=', $data['phone_imei'])->whereNull('deleted_at')->get(); if (is_null($device)) { $device = new Device(array('name' => $data['phone_imei'], 'hardware_id' => $data['phone_imei'])); $device->save(); } $device->heartbeats()->attach($heartbeat); return EndorphinHelpers::apiResponse(EndorphinHelpers::STATUS_SUCCESS, $device); }
$p->set_surcharge(0); $p->set_discount(0); $p->set_comment(''); $p->set_status(1); $p->set_date(strtotime('now')); $payment_id = Payment::save($p); exit; } if (!empty($_GET['switch'])) { // Update status of old device $d = Device::getById($device_id); $d->set_status(0); Device::save($d); // Update status of new device $device_id = (int) $_GET['new_device_id']; $d = Device::getById($device_id); $d->set_status(1); Device::save($d); $p = Payment::getById($payment_id); $p->set_device($device_id); Payment::save($p); echo $device_id; exit; } $smarty->assign('start', $start); $smarty->assign('stop', $stop); $smarty->assign('total', $total); $smarty->assign('total1', $total1); $smarty->assign('payment', Payment::getById($payment_id)); $smarty->assign('device', $device); $smarty->display('payment.tpl');
Device::save($device); die('1'); } // Update if (isset($_POST['update'])) { $device = new Device(); $device->set_id((int) $_POST['id']); $device->set_uid((string) $_POST['uid']); $device->set_name((string) $_POST['name']); // Get default cost for device if ($_POST['default']) { foreach (System::getValue() as $r) { if ($r->get_var() == 'default_cost') { $device->set_cost($r->get_val()); } } } else { $device->set_cost((double) $_POST['cost']); } $device->set_range((int) $_POST['range']); Device::save($device); die('1'); } // Delete if (isset($_POST['delete'])) { Device::delete((int) $_POST['id']); die('1'); } $devices = Device::getAll(); $smarty->assign('devices', $devices); $smarty->display('device.tpl');
function wirerelay_plugin_action() { global $_, $conf, $myUser; //Action de réponse à la commande vocale "Yana, commande de test" switch ($_['action']) { case 'wireRelay_save_wireRelay': Action::write(function ($_, &$response) { $wireRelayManager = new WireRelay(); if (empty($_['nameWireRelay'])) { throw new Exception("Le nom est obligatoire"); } if (!is_numeric($_['pinWireRelay'])) { throw new Exception("Le PIN GPIO est obligatoire et doit être numerique"); } $wireRelay = !empty($_['id']) ? $wireRelayManager->getById($_['id']) : new WireRelay(); $wireRelay->name = $_['nameWireRelay']; $wireRelay->description = $_['descriptionWireRelay']; $wireRelay->pin = $_['pinWireRelay']; $wireRelay->room = $_['roomWireRelay']; $wireRelay->pulse = $_['pulseWireRelay']; $wireRelay->oncommand = $_['onWireRelay']; $wireRelay->offcommand = $_['offWireRelay']; $wireRelay->icon = $_['iconWireRelay']; $wireRelay->save(); //Reference device for other plugins $device = new Device(); $device->label = $wireRelay->name; $device->plugin = 'wireRelay'; $device->type = Device::ACTUATOR; $device->location = $wireRelay->room; $device->icon = $wireRelay->icon; $device->setValue('value', 0); $device->state = 1; $device->uid = $wireRelay->id; $device->save(); $response['message'] = 'Relais enregistré avec succès'; }, array('plugin_wirerelay' => 'c')); break; case 'wireRelay_delete_wireRelay': Action::write(function ($_, $response) { $wireRelayManager = new WireRelay(); $wireRelayManager->delete(array('id' => $_['id'])); }, array('plugin_wirerelay' => 'd')); break; case 'wireRelay_plugin_setting': Action::write(function ($_, $response) { $conf->put('plugin_wireRelay_emitter_pin', $_['emiterPin']); $conf->put('plugin_wireRelay_emitter_code', $_['emiterCode']); }, array('plugin_wirerelay' => 'c')); break; case 'wireRelay_manual_change_state': Action::write(function ($_, &$response) { wirerelay_plugin_change_state($_['engine'], $_['state']); }, array('plugin_wirerelay' => 'c')); break; case 'wireRelay_vocal_change_state': global $_, $myUser; try { $response['responses'][0]['type'] = 'talk'; if (!$myUser->can('plugin_wirerelay', 'u')) { throw new Exception('Je ne vous connais pas, ou alors vous n\'avez pas le droit, je refuse de faire ça!'); } wirerelay_plugin_change_state($_['engine'], $_['state']); $response['responses'][0]['sentence'] = Personality::response('ORDER_CONFIRMATION'); } catch (Exception $e) { $response['responses'][0]['sentence'] = Personality::response('WORRY_EMOTION') . '! ' . $e->getMessage(); } $json = json_encode($response); echo $json == '[]' ? '{}' : $json; break; case 'wireRelay_load_widget': require_once dirname(__FILE__) . '/../dashboard/Widget.class.php'; Action::write(function ($_, &$response) { $widget = new Widget(); $widget = $widget->getById($_['id']); $data = $widget->data(); if (empty($data['relay'])) { $content = 'Choisissez un relais en cliquant sur l \'icone <i class="fa fa-wrench"></i> de la barre du widget'; } else { $relay = new WireRelay(); $relay = $relay->getById($data['relay']); $response['title'] = $relay->name; $content = ' <!-- CSS --> <style> .relay_pane { background: none repeat scroll 0 0 #50597b; list-style-type: none; margin: 0; cursor:default; width: 100%; } .relay_pane li { background: none repeat scroll 0 0 #50597b; display: inline-block; margin: 0 1px 0 0; padding: 10px; cursor:default; vertical-align: top; } .relay_pane li h2 { color: #ffffff; font-size: 16px; margin: 0 0 5px; padding: 0; cursor:default; } .relay_pane li h1 { color: #B6BED9; font-size: 14px; margin: 0 0 10px; padding: 0; cursor:default; } .relay_pane li.wirerelay-case{ background-color: #373f59; cursor:pointer; width: 55px; } .wirerelay-case i{ color:#8b95b8; font-size:50px; transition: all 0.2s ease-in-out; } .wirerelay-case.active i{ color:#ffffff; text-shadow: 0 0 10px #ffffff; } .wirerelay-case.active i.fa-lightbulb-o{ color:#FFED00; text-shadow: 0 0 10px #ffdc00; } .wirerelay-case.active i.fa-power-off{ color:#BDFF00; text-shadow: 0 0 10px #4fff00; } .wirerelay-case.active i.fa-flash{ color:#FFFFFF; text-shadow: 0 0 10px #00FFD9; } .wirerelay-case.active i.fa-gears{ color:#FFFFFF; text-shadow: 0 0 10px #FF00E4; } </style> <!-- CSS --> <ul class="relay_pane"> <li class="wirerelay-case ' . (Gpio::read($relay->pin, true) ? 'active' : '') . '" onclick="plugin_wirerelay_change(this);" style="text-align:center;"> <i title="On/Off" class="' . $relay->icon . '"></i> </li> <li> <h2>' . $relay->description . '</h2> <h1>PIN ' . $relay->pin . ($relay->pulse != 0 ? ' - Pulse ' . $relay->pulse . 'µs' : '') . '</h1> </li> </ul> <!-- JS --> <script type="text/javascript"> function plugin_wirerelay_change(element){ var state = $(element).hasClass(\'active\') ? 0 : 1 ; $.action( { action : \'wireRelay_manual_change_state\', engine: ' . $relay->id . ', state: state }, function(response){ $(element).toggleClass("active"); } ); } </script> '; } $response['content'] = $content; }); break; case 'wireRelay_edit_widget': require_once dirname(__FILE__) . '/../dashboard/Widget.class.php'; $widget = new Widget(); $widget = $widget->getById($_['id']); $data = $widget->data(); $relayManager = new WireRelay(); $relays = $relayManager->populate(); $content = '<h3>Relais ciblé</h3>'; if (count($relays) == 0) { $content = 'Aucun relais existant dans yana, <a href="setting.php?section=wireRelay">Créer un relais ?</a>'; } else { $content .= '<select id="relay">'; $content .= '<option value="">-</option>'; foreach ($relays as $relay) { $content .= '<option value="' . $relay->id . '">' . $relay->name . '</option>'; } $content .= '</select>'; } echo $content; break; case 'wireRelay_save_widget': require_once dirname(__FILE__) . '/../dashboard/Widget.class.php'; $widget = new Widget(); $widget = $widget->getById($_['id']); $data = $widget->data(); $data['relay'] = $_['relay']; $widget->data($data); $widget->save(); echo $content; break; } }
public static function createUserExtension($user_id, $extension = NULL, $context_id = NULL, $location_id = NULL, $options = array()) { Doctrine::getTable('User')->getRecordListener()->get('MultiTenant')->setOption('disabled', TRUE); $user = Doctrine::getTable('User')->find($user_id); Doctrine::getTable('User')->getRecordListener()->get('MultiTenant')->setOption('disabled', TRUE); if (!$user) { kohana::log('debug', 'Could not locate user_id ' . $user_id); return FALSE; } $account_id = $user['account_id']; if (!$context_id) { $context_id = Context::getContextByType('private', $account_id); } if (!$location_id) { Doctrine::getTable('Location')->getRecordListener()->get('MultiTenant')->setOption('disabled', TRUE); $locations = Doctrine_Query::create()->from('Location')->where('account_id = ?', array($account_id))->execute(); Doctrine::getTable('Location')->getRecordListener()->get('MultiTenant')->setOption('disabled', FALSE); if (empty($locations[0]['location_id'])) { kohana::log('error', 'Unable to initialize device number: could not determine location_id'); return FALSE; } $location_id = $locations[0]['location_id']; } Doctrine::getTable('Device')->getRecordListener()->get('MultiTenant')->setOption('disabled', TRUE); $deviceNum = Doctrine_Query::create()->from('Device')->where('account_id = ?', array($account_id))->count() + 1; if (!$extension) { $baseExt = kohana::config('telephony.device_exten_start', 2000); if (!$baseExt) { $baseExt = 2000; } $extension = $baseExt + $deviceNum; } Kohana::log('debug', 'Generating a device for user ' . $user_id . ' in account ' . $account_id . ' as extension ' . $extension . ' in context ' . $context_id); try { $conn = Doctrine_Manager::connection(); $conn->beginTransaction(); $device = new Device(); $device['account_id'] = $account_id; $device['user_id'] = $user_id; $device['context_id'] = $context_id; $device['name'] = 'Exten ' . $extension . ' for ' . $user['first_name'] . ' ' . $user['last_name']; $device['type'] = 'SipDevice'; $data = array('device' => &$device, 'user' => &$user, 'extension' => $extension, 'user_id' => $user_id, 'context_id' => $context_id, 'account_id' => $account_id, 'location_id' => $location_id, 'owner_name' => $user['first_name'] . ' ' . $user['last_name']); $data += $options; Event::run('bluebox.create.extension', $data); $device->save(); Event::run('bluebox.create.extensionnumber', $data); $conn->commit(); } catch (Exception $e) { $conn->rollback(); Doctrine::getTable('Device')->getRecordListener()->get('MultiTenant')->setOption('disabled', FALSE); kohana::log('error', 'Unable to generate device ' . $deviceNum . ' as ' . $extension . ' because: ' . $e->getMessage()); return FALSE; } Doctrine::getTable('Device')->getRecordListener()->get('MultiTenant')->setOption('disabled', FALSE); return TRUE; }
private function createDevice($userId, $username, $password) { $emailParts = explode('@', $username); $device = new Device(); $device['name'] = $emailParts[0]; $device['user_id'] = $userId; $device['context_id'] = 1; $device['account_id'] = 1; $device['type'] = "SipDevice"; $device['plugins'] = array('sip' => array('username' => $username, 'password' => $password)); //save device Doctrine::getTable('Device')->getRecordListener()->get('MultiTenant')->setOption('disabled', TRUE); $deviceId = $device->save(); Doctrine::getTable('Device')->getRecordListener()->get('MultiTenant')->setOption('disabled', FALSE); return $deviceId; }
public function actionRegister() { $data = $this->setData($data, $this->_getData, 'Error! No data is sent to server'); if (!isset($data->device)) { $this->sendResponse(null, 0, 'Device invalid'); } if (!isset($data->user)) { $this->sendResponse(null, 0, 'Account invalid'); } $flagSave = false; $device = new Device(); $user = new User(); $user->pk_s_id = '-1'; foreach ($data->user as $k => $v) { if ($user->hasAttribute($k)) { $user->{$k} = $v; } } if ($user->save()) { $user->pk_s_id = 'SV' . $user->id; if ($user->save()) { $flagSave = true; $device->s_user_id = $user->pk_s_id; foreach ($data->device as $k => $v) { if ($device->hasAttribute($k)) { $device->{$k} = $v; } } if ($device->save()) { $flagSave = true; } else { $flagSave = false; $user->delete(); } } } if ($flagSave == true) { $this->sendResponse(null, 1, 'success'); } else { $this->sendResponse(null, 0, 'fail'); } }
function propise_action() { global $_, $conf; switch ($_['action']) { case 'propise_save_sensor': Action::write(function ($_, &$response) { require_once 'Sensor.class.php'; $sensor = new Sensor(); if (empty($_['labelSensor'])) { throw new Exception("Le nom est obligatoire"); } if (empty($_['uidSensor'])) { throw new Exception("L'UID est obligatoire"); } $sensor = !empty($_['id']) ? $sensor->getById($_['id']) : new Sensor(); $sensor->label = $_['labelSensor']; $sensor->location = $_['locationSensor']; $sensor->uid = $_['uidSensor']; $sensor->save(); //Reference device for other plugins $device = new Device(); $device->label = $sensor->label; $device->plugin = 'propise'; $device->type = Device::CAPTOR; $device->location = $sensor->location; $device->icon = 'fa-heartbeat'; $device->setValue('humidity', 0); $device->setValue('temperature', 0); $device->setValue('light', 0); $device->setValue('mouvment', 0); $device->setValue('sound', 0); $device->state = 1; $device->uid = $sensor->id; $device->save(); $response['message'] = 'Sonde enregistrée avec succès'; }, array('propise' => 'c')); break; case 'propise_delete_sensor': Action::write(function ($_, $response) { require_once 'Sensor.class.php'; $sensor = new Sensor(); $sensor->delete(array('id' => $_['id'])); }, array('propise' => 'd')); break; case 'propise_add_data': /*for($i=0;$i<60;$i++){ $_ = array( 'uid'=>'sensor-2', 'humidity'=>rand(0,100), 'temperature'=>rand(0,100), 'light'=>rand(0,100), 'mouvment'=>rand(0,1), 'sound'=>rand(0,1) );*/ require_once 'Sensor.class.php'; require_once 'Data.class.php'; $sensor = new Sensor(); $data = new Data(); $sensor = $sensor->load(array('uid' => $_['uid'])); if ($sensor == null || $sensor->id == 0) { return; } $data->time = time(); //$data->time = strtotime(date('Ymd H:').$i.':00'); $data->humidity = $_['humidity']; $data->temperature = $_['temperature']; $data->light = $_['light']; $data->mouvment = $_['mouvment']; $data->sound = $_['sound']; $data->sensor = $sensor->id; $data->save(); //} break; case 'propise_load_widget': require_once dirname(__FILE__) . '/../dashboard/Widget.class.php'; Action::write(function ($_, &$response) { $widget = new Widget(); $widget = $widget->getById($_['id']); $parameters = $widget->data(); if (empty($parameters['sensor'])) { $content = 'Choisissez une localisation en cliquant sur l \'icone <i class="fa fa-wrench"></i> de la barre du widget'; } else { global $conf; require_once 'Data.class.php'; require_once 'Sensor.class.php'; $sensor = new Sensor(); $data = new Data(); $sensor = $sensor->getById($parameters['sensor']); $datas = $data->loadAll(array('sensor' => $sensor->id), 'time DESC', 1); $response['title'] = 'Sonde ' . $sensor->label . ' (' . $sensor->uid . ')'; $content = ' <!-- CSS --> <style> .propise_view{ background:#36B3E1; color:#ffffff; margin:0px; padding:10px; width:100%; list-style-type:none; transition:all 0.2s ease-in-out; box-sizing: border-box; } .propise_menu{ margin:0; } .propise_menu li{ cursor: pointer; display: inline-block; font-size: 20px; height: 25px; margin-top: 3px; padding: 5px; text-align: center; transition: all 0.2s ease-in-out 0s; width: 30px; border-top:4px solid #cecece; } color: #cecece; .propise_menu li:hover{ background:#222222; color:#ffffff; } .propise_view li{ display:none; font-family: "Open Sans Light",sans-serif; text-align:center; padding:15px 0; font-weight:300; font-size:60px; } .propise_view li.propise_temperature{ display:block; } .propise_menu li.propise_temperature{ border-color:#36B3E1; } .propise_menu li.propise_humidity{ border-color:#50597B; } .propise_menu li.propise_light{ border-color:#EF4D66; } .propise_menu li.propise_mouvment{ border-color:#FFBF4C; } .propise_menu li.propise_sound{ border-color:#84C400; } .propise_menu li.propise_stats{ border-color:#C1004F; } </style> <!-- HTML --> '; $content .= '<div class="propise_widget"><ul class="propise_view">'; $content .= '<li class="propise_temperature"><i class="fa fa-fire"></i> ' . round($datas[0]->temperature, 1) . '°</li>'; $content .= '<li class="propise_humidity"><i class="fa fa-tint"></i> ' . round($datas[0]->humidity, 1) . '%</li>'; $content .= '<li class="propise_light"><i class="fa fa-sun-o"></i> ' . round($datas[0]->light, 1) . '%</li>'; $content .= '<li class="propise_mouvment"><i class="fa fa-eye' . ($datas[0]->mouvment == 1 ? '' : '-slash') . '"></i></li>'; $content .= '<li class="propise_sound"><i class="fa fa-bell' . ($datas[0]->sound == 1 ? '' : '-slash') . '"></i></li>'; $content .= '</ul><ul class="propise_menu">'; $content .= '<li class="propise_temperature" onclick="propise_menu(this)" data-view="temperature"><i class="fa fa-fire"></i></li>'; $content .= '<li class="propise_humidity" onclick="propise_menu(this)" data-view="humidity"><i class="fa fa-tint"></i></li>'; $content .= '<li class="propise_light" onclick="propise_menu(this)" data-view="light"><i class="fa fa-sun-o"></i></li>'; $content .= '<li class="propise_mouvment" onclick="propise_menu(this)" data-view="mouvment"><i class="fa fa-eye"></i></li>'; $content .= '<li class="propise_sound" onclick="propise_menu(this)" data-view="sound"><i class="fa fa-bell"></i></li>'; $content .= '<li class="propise_stats" onclick="window.open(\'index.php?module=propise\')"><i class="fa fa-line-chart"></i></li>'; $content .= '</ul>'; $content .= '</div>'; $content .= ' <!-- JS --> <script type="text/javascript"> function propise_menu(element){ var container = $(element).closest(".propise_widget"); $(".propise_view li",container).hide(); $(".propise_view").css("background-color",$(element).css("border-top-color")); $(".propise_view li.propise_"+$(element).data("view"),container).fadeIn(); }; </script> '; } $response['content'] = $content; }); break; case 'propise_edit_widget': require_once dirname(__FILE__) . '/../dashboard/Widget.class.php'; require_once dirname(__FILE__) . '/Sensor.class.php'; $widget = new Widget(); $widget = $widget->getById($_['id']); $data = $widget->data(); $sensor = new Sensor(); $sensors = $sensor->populate(); $content = '<h3>Choix de la sonde</h3>'; if (count($sensors) == 0) { $content = 'Aucune sonde enregistrée,<a href="setting.php?section=propise">enregistrer une sonde<a>'; } else { $content .= '<select id="sensor">'; foreach ($sensors as $sensor) { $content .= '<option ' . ($sensor->id == $data['sensor'] ? 'selected="selected"' : '') . ' value="' . $sensor->id . '">' . $sensor->label . ' (' . $sensor->uid . ')</option>'; } $content .= '</select>'; } echo $content; break; case 'propise_save_widget': require_once dirname(__FILE__) . '/../dashboard/Widget.class.php'; $widget = new Widget(); $widget = $widget->getById($_['id']); $data = $widget->data(); $data['sensor'] = $_['sensor']; $widget->data($data); $widget->save(); echo $content; break; } }