$location_id = $my_app->get_param('location');
    $id_parent = 0;
    switch ($location_id) {
        case 'desktop':
            $location = 'desktop';
            break;
        case 'menustart':
            $location = 'menustart';
            break;
        case 'db':
            $location = 'db';
            break;
        case 'edit':
            $location = 'edit';
            break;
    }
    $db_parent = $my_app->get_param('dir_id');
    if (!empty($db_parent)) {
        $id_parent = $db_parent;
    }
    $post_app_params['url'] = base64_encode($_POST['new_link_url']);
    if (globalconfig('demo_mode') != 1 || is_root()) {
        if ($location != 'edit') {
            $shortcut->add($_POST['new_link_name'], $_POST['new_link_type'], 'mediaframes', $_POST['new_link_action'], $_POST['new_link_icon'], $post_app_params, $location, $id_parent);
            msg::ok(txt('created'));
        } else {
            $shortcut->update($_POST['new_link_name'], $_POST['new_link_type'], 'mediaframes', $_POST['new_link_action'], $_POST['new_link_icon'], $post_app_params, $location, $my_app->get_param('link_id'));
            msg::ok(txt('updated'));
        }
    }
}
 public function save_file_content($file_name, $content)
 {
     global $my_app;
     $explorerAPI = new phpos_explorerAPI();
     $explorerAPI->set_window_id($my_app->get_param('win_id'));
     $app_data = $explorerAPI->get_cached_app_data();
     $shortcut = new phpos_shortcuts();
     $app_params['content'] = 1;
     if (false !== ($record_id = $shortcut->add($file_name, 'app', $app_data['app_id'], $app_data['app_action'], null, $app_params, 'db', $my_app->get_param('dir_id'), $content))) {
         $file['id'] = $record_id;
         return $this->get_file_info($file);
     }
 }
Exemple #3
0
    $location_id = $my_app->get_param('location');
    $id_parent = 0;
    switch ($location_id) {
        case 'desktop':
            $location = 'desktop';
            break;
        case 'menustart':
            $location = 'menustart';
            break;
        case 'db':
            $location = 'db';
            break;
        case 'edit':
            $location = 'edit';
            break;
    }
    $db_parent = $my_app->get_param('dir_id');
    if (!empty($db_parent)) {
        $id_parent = $db_parent;
    }
    $post_app_params['url'] = base64_encode($_POST['new_link_url']);
    if (globalconfig('demo_mode') != 1 || is_root()) {
        if ($location != 'edit') {
            $shortcut->add($_POST['new_link_name'], $_POST['new_link_type'], 'links', 'index', $_POST['new_link_icon'], $post_app_params, $location, $id_parent);
            msg::ok(txt('created'));
        } else {
            $shortcut->update($_POST['new_link_name'], $_POST['new_link_type'], 'links', 'index', $_POST['new_link_icon'], $post_app_params, $location, $my_app->get_param('link_id'));
            msg::ok(txt('updated'));
        }
    }
}