コード例 #1
0
if (isset($_REQUEST['id']) && strlen($_REQUEST['id']) < 25) {
    $id = strip_tags($_REQUEST['id']);
}
# START OUTPUT
LS_page_start('empty');
# Left nav pane echoing
echo '<div class="navi" style="left: 5px;">' . _button('NEU Klass. / Msggr.', '', 'admin_liga_types.php?op=new') . _button('Admin home', '', 'admin_main_menu.php') . '</div>';
echo '<h3>Klassen / Messagegroups</h3>';
# header and start table
switch ($myop) {
    case "list":
        echo object_list();
        break;
    case "new":
        echo object_form();
        break;
    case "edit":
        echo object_form($id);
        break;
    case "save":
        save_object($id);
        echo object_list();
        break;
    case "delete":
        delete_object($id);
        echo object_list();
        break;
}
echo '</td></tr></table>';
# end table
LS_page_end();
コード例 #2
0
/**
 *	set the user-defined css file
 *
 *	@param array $args arguments
 *		key 'page' is the page (i.e. page.rev) or false the global css
 *		key 'css' is the content of the css file
 *	@return array response
 *		true if successful
 */
function user_css_set_css($args)
{
    if (!isset($args['page']) || $args['page'] !== false && !page_exists($args['page'])) {
        return response('Required argument "page" missing or invalid', 400);
    }
    if (!isset($args['css'])) {
        return response('Required argument "css" missing', 400);
    }
    if ($args['page'] === false) {
        // TODO (later): drop_cache()
        if (empty($args['css'])) {
            // empty stylesheet
            @unlink(CONTENT_DIR . '/usercss');
            return response(true);
        } else {
            $m = umask(0111);
            if (!@file_put_contents(CONTENT_DIR . '/usercss', $args['css'])) {
                umask($m);
                return response('Error saving stylesheet', 500);
            } else {
                umask($m);
                return response(true);
            }
        }
    } else {
        drop_cache('page', $args['page']);
        load_modules('glue');
        if (empty($args['css'])) {
            delete_object(array('name' => $args['page'] . '.usercss'));
            return response(true);
        } else {
            return update_object(array('name' => $args['page'] . '.usercss', 'type' => 'usercss', 'module' => 'user_css', 'content' => $args['css']));
        }
    }
}
コード例 #3
0
/**
 *	set the user-defined code files
 *
 *	@param array $args arguments
 *		key 'page' is the page (i.e. page.rev) or false the global code
 *		key 'head' is the content of the head file
 *		key 'body' is the content of the body file
 *	@return array response
 *		true if successful
 */
function user_code_set_code($args)
{
    if (!isset($args['page']) || $args['page'] !== false && !page_exists($args['page'])) {
        return response('Required argument "page" missing or invalid', 400);
    }
    if (!isset($args['head'])) {
        return response('Required argument "head" missing', 400);
    }
    if (!isset($args['body'])) {
        return response('Required argument "body" missing', 400);
    }
    if ($args['page'] === false) {
        drop_cache('page');
        foreach (array('head', 'body') as $x) {
            if (empty($args[$x])) {
                @unlink(CONTENT_DIR . '/user' . $x);
            } else {
                $m = umask(0111);
                if (!@file_put_contents(CONTENT_DIR . '/user' . $x, $args[$x])) {
                    umask($m);
                    return response('Error saving user ' . $x, 500);
                } else {
                    umask($m);
                }
            }
        }
        return response(true);
    } else {
        drop_cache('page', $args['page']);
        load_modules('glue');
        foreach (array('head', 'body') as $x) {
            if (empty($args[$x])) {
                delete_object(array('name' => $args['page'] . '.user' . $x));
            } else {
                update_object(array('name' => $args['page'] . '.user' . $x, 'type' => 'user' . $x, 'module' => 'user_code', 'content' => $args[$x]));
            }
        }
        return response(true);
    }
}
コード例 #4
0
ファイル: ner.php プロジェクト: gisly/opencorpora
         throw new UnexpectedValueException();
     }
     delete_object_prop_val($_POST['val_id']);
     break;
 case 'getObjects':
     if (empty($_POST['book_id'])) {
         throw new UnexpectedValueException();
     }
     $result['objects'] = get_book_objects($_POST['book_id']);
     $result['possible_props'] = get_possible_properties();
     break;
 case 'deleteObject':
     if (empty($_POST['object_id'])) {
         throw new UnexpectedValueException();
     }
     delete_object($_POST['object_id']);
     break;
 case 'finishModeration':
     if (empty($_POST['book_id']) or empty($_POST['tagset_id'])) {
         throw new Exception("book_id or tagset_id missing");
     }
     finish_book_moderation($_POST['book_id'], $_POST['tagset_id']);
     break;
 case 'restartModeration':
     if (empty($_POST['book_id']) or empty($_POST['tagset_id'])) {
         throw new Exception("book_id or tagset_id missing");
     }
     restart_book_moderation($_POST['book_id'], $_POST['tagset_id']);
     break;
 case 'logEvent':
     if (empty($_POST['id'])) {
コード例 #5
0
 function __dispose()
 {
     delete_object($this->id);
     $this->disposed = true;
 }
コード例 #6
0
ファイル: tutorial.php プロジェクト: zhang19960118/html11
    $response = $obj->batch_upload_file($options);
}
/*%**************************************************************************************************************%*/
// 签名url 相关
//生成签名url,主要用户私有权限下的访问控制
function get_sign_url($obj)
{
    $bucket = 'phpsdk1349849394';
    $object = 'netbeans-7.1.2-ml-cpp-linux.sh';
    $timeout = 3600;
    $response = $obj->get_sign_url($bucket, $object, $timeout);
    var_dump($response);
}
/*%**************************************************************************************************************%*/
// 结果 相关
//格式化返回结果
function _format($response)
{
    echo '<pre>';
    echo '|-----------------------Start---------------------------------------------------------------------------------------------------' . "\n";
    echo '|-Status:' . $response->status . "\n";
    echo '|-Body:' . "\n";
    echo $response->body . "\n";
    echo "|-Header:\n";
    print_r($response->header);
    echo '-----------------------End-----------------------------------------------------------------------------------------------------' . "\n\n";
}
get_service($oss_sdk_service);
get_object_meta($oss_sdk_service);
delete_object($oss_sdk_service);
コード例 #7
0
<?php

/* This file handles the function of learning object deletion. */
require_once 'repository_fns.php';
session_start();
$objid = $_GET['objid'];
do_html_header_member();
if (delete_object($objid)) {
    echo '<div class="container theme-showcase">';
    echo '<div class="page-header">';
    echo '<p>Object was deleted.</p>';
    echo '</div>';
    echo '</div>';
} else {
    echo '<div class="container theme-showcase">';
    echo '<div class="page-header">';
    echo '<p>Object could not be deleted.</p>';
    echo '</div>';
    echo '</div>';
}
echo '<div class="container theme-showcase">';
echo '<div class="page-header">';
do_html_url("member.php", "Go back to member page");
echo '</div>';
echo '</div>';
do_html_footer();
コード例 #8
0
/**
 *	create a symlink pointing to an object in all other pagename's head revisions
 *
 *	@param array $args arguments
 *		key 'name' is the object name (i.e. page.rev.obj)
 *	@return array response
 */
function object_make_symlink($args)
{
    if (empty($args['name'])) {
        return response('Required argument "name" missing or empty', 400);
    }
    if (!object_exists($args['name'])) {
        return response('Object ' . quot($args['name']) . ' does not exist', 404);
    }
    $a = expl('.', $args['name']);
    // see if the object is itself a symlink
    $ret = object_get_symlink($args);
    $ret = $ret['#data'];
    if ($ret !== false && $ret !== '') {
        // create a symlink pointing to the object's target instead
        $target = '../../' . str_replace('.', '/', $ret);
        // skip both the original object's pagename and the new target's pagename
        $a_target = expl('.', $ret);
        $skip_pns = array($a[0], $a_target[0]);
    } else {
        $target = '../../' . str_replace('.', '/', $args['name']);
        $skip_pns = array($a[0]);
    }
    $pns = pagenames(array());
    $pns = $pns['#data'];
    // for every pagename
    foreach ($pns as $pn) {
        if (in_array($pn, $skip_pns)) {
            continue;
        }
        // check if the head revision exists
        if (is_dir(CONTENT_DIR . '/' . $pn . '/head')) {
            $link = CONTENT_DIR . '/' . $pn . '/head/' . $a[2];
            if (is_file($link) && !is_link($link)) {
                // delete objects with the same name
                // these should have been created when shapshotting and the
                // revision has later been reverted to
                delete_object(array('name' => $pn . '.head.' . $a[2]));
            } elseif (is_link($link) && !is_file($link) && !is_dir($link)) {
                // delete dangling symlinks too
                if (@unlink($link)) {
                    log_msg('info', 'object_make_symlink: deleted dangling symlink ' . quot($pn . '.head.' . $a[2]));
                } else {
                    log_msg('error', 'object_make_symlink: error deleting dangling symlink ' . quot($pn . '.head.' . $a[2]));
                }
            }
            // try to create symlink
            if (@symlink($target, $link)) {
                log_msg('debug', 'object_make_symlink: ' . quot($pn . '.head.' . $a[2]) . ' -> ' . quot($target));
                // drop the page from cache
                drop_cache('page', $pn . '.head');
            }
        }
    }
    return response(true);
}
コード例 #9
0
ファイル: model_classes.php プロジェクト: rchrd2/db_serialize
 function cleanDelete()
 {
     // delete this from db
     connect_db();
     delete_object('Project', (int) $this->uid);
     // delete the files
     safeDelete(UPLOAD_PATH . '/' . $this->file);
     safeDelete(UPLOAD_PATH . '/' . $this->thumb);
 }