Example #1
0
     break;
 case 'new':
     if (post('did_submit') == 'yes') {
         $clientid = create_client(null, post('first_name'), post('last_name'), post('gender') == '1', post('dob'));
         if ($clientid > 0) {
             $familyid = create_family($clientid, post('bag'), post('address'), post('telephone'), post('fuel') == 'true', post('usda') == 'true', post('delivery') == 'true', post('dietary') == 'true', post('2nd') == 'true', post('4th') == 'true', post('cooking') == 'true', post('start'), post('comments'));
             if ($familyid > 0) {
                 redirect($g["abs_url"] . '/client/edit/' . $familyid);
             } else {
                 $client_framework_render['message'] = 'An error occurred.<br />';
             }
         } else {
             $client_framework_render['message'] = 'An error occurred.<br />';
         }
     }
     render_new();
     break;
 case 'edit':
     if (post('did_submit') == 'yes') {
         edit_client($client_command, post('first_name'), post('last_name'), post('gender') == '1', post('dob'));
         edit_family($client_command, post('bag'), post('active') == 'true', post('address'), post('telephone'), post('fuel') == 'true', post('usda') == 'true', post('delivery') == 'true', post('dietary') == 'true', post('2nd') == 'true', post('4th') == 'true', post('cooking') == 'true', post('start'), post('comments'));
         clear_financial_aids($client_command);
         $aids = get_all_financial_aids();
         foreach ($aids as $aid) {
             $field = clean_url($aid['name']);
             $check = post('aid-' . $field);
             $amount = post('aid-' . $field . '-text');
             if ($check == 'true') {
                 set_financial_aid($client_command, $aid['aidid'], $amount);
             }
         }
        if ($_POST['bot_icon']) {
            $instance->icfg['bot_icon'] = $_POST['bot_icon'];
        }
        $instance->saveConfig();
    } else {
        $instance = createPluginInstance($id);
        $instance->iid = $_POST['uid'];
        $instance->onParentInit();
        $instance->onInit();
        $instance->icfg['created'] = time();
        $instance->icfg['creator_id'] = $GLOBALS['cfg']['user']['user_id'];
        $instance->icfg['channel'] = $_POST['channel'];
        $instance->icfg['channel_name'] = $instance->getChannelName($_POST['channel']);
        $instance->saveConfig();
    }
    header("location: view.php?id={$instance->iid}");
    exit;
}
if (!isset($plugins[$id])) {
    die("plugin not found");
}
$instance = createPluginInstance($id);
$instance->createInstanceId();
$instance->checkRequirements();
$smarty->assign('instance', $instance);
$newpage = render_new($GLOBALS['cfg']['team'], $instance);
$smarty->assign('html', $newpage);
$smarty->assign('id', $id);
$smarty->assign('p_name', $instance::NAME);
$smarty->assign('p_desc', $instance::DESC);
$smarty->display('new_plugin.txt');