当前位置: 首页>>代码示例>>PHP>>正文


PHP URIinfo函数代码示例

本文整理汇总了PHP中URIinfo函数的典型用法代码示例。如果您正苦于以下问题:PHP URIinfo函数的具体用法?PHP URIinfo怎么用?PHP URIinfo使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了URIinfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: html2cell

        $msg = html2cell($done);
        #echo $done;
        #ereg('<error>(.*)</error>(.*)<message>(.*)</message>', $done, $s3qlout);
        if ($msg[2]['error_code'] == '0') {
            #echo str_replace(array('&rule_id='.$_REQUEST['rule_id'], '&action=delete'),array('',''),$action['editrules']);
            Header('Location:' . str_replace(array('&rule_id=' . $_REQUEST['rule_id'], '&action=delete'), array('', ''), $action['editrules']));
            #since resource has became extinct, redirect to the project's page
            exit;
        } else {
            $message .= '<br />' . $msg[2]['message'];
        }
    }
    #include all the javascript functions for the menus...
    include '../S3DBjavascript.php';
    #and the short menu for the resource script
    $rule_info = URIinfo('R' . $rule_id, $user_id, $key, $db);
    $message .= "Do you really want to delete this rule? <br /> Select 'Delete Rule' to remove all the statements that depend on this rule; select 'Unlink' to remove the rule from this project but leave it available for other projects";
}
?>

<table class="middle" width="100%"  align="center">
	<tr><td>
		<table class="insidecontents" width="90%"  align="center" border="0">
			<tr><td class="message" colspan="9"><br /></td></tr>
			<tr bgcolor="#80BBFF"><td align="center" colspan="8">Delete Rule<input type="hidden" name="rule_id" value="7"></td></tr>
			<tr class="odd">
				<?php 
echo '<td class="message" colspan="8">' . $message . '</b><br /><br /></td>';
?>
			</tr>
			<tr class="odd">
开发者ID:helenadeus,项目名称:s3db.map,代码行数:31,代码来源:deleterule.php

示例2: fileUploadFromValue

function fileUploadFromValue($s3ql, $db, $user_id)
{
    //is there a filename?
    $filename = $s3ql['where']['file_name'] != '' ? $s3ql['where']['file_name'] : 'file_' . random_string(10) . '_' . $s3ql['where']['rule_id'] . '_' . $s3ql['where']['item_id'] . '.txt';
    //when statement_id is provided, use it; if file exists, append, otherwise create
    if ($s3ql['where']['statement_id'] != '') {
        $statement_id = $s3ql['where']['statement_id'];
        $stat_info = URIinfo('S' . $statement_id, $user_id, $s3ql['key'], $db);
        if (!is_array($stat_info)) {
            $msg = "Statement " . $statement_id . " not found";
            return $msg;
        } elseif (!$stat_info['change']) {
            $msg = "User does not have permission to edut S" . $statement_id . ".";
            return $msg;
        }
        if ($s3ql['where']['file_name'] != '' && $stat_info['file_name'] != $filename) {
            $msg = "Statement_id " . $statement_id . " does not have a file called " . $filename;
            return $msg;
        }
        $filename = $stat_info['file_name'];
        $rule_id = $stat_info['rule_id'];
        $project_id = $stat_info['project_id'];
        $folder = $stat_info['project_folder'];
        $item_id = $stat_info['item_id'];
    }
    ereg('.*\\.([a-zA-Z0-9]*)$', $filename, $tmp);
    $extension = $tmp[1];
    $name = ereg_replace('\\.' . $extension . '$', '', $filename);
    if ($statement_id) {
        //if there is already
        #find the file, open it, add the fragment and return
        $maindir = $GLOBALS['s3db_info']['server']['db']['uploads_folder'] . $GLOBALS['s3db_info']['server']['db']['uploads_file'];
        $fileLocation = $maindir . '/' . $folder;
        $file_in_folder = $fileLocation . '/' . $name . '_' . $project_id . '_' . $item_id . '_' . $rule_id . '_' . strval($statement_id) . '.' . $extension;
        if (is_file($file_in_folder)) {
            $a = fopen($file_in_folder, 'a');
            if (fwrite($a, $s3ql['where']['value'])) {
                $s3ql['statement_id'] = $statement_id;
                $s3ql['file_name'] = $filename;
                return $s3ql;
            }
        }
    }
    //when the file already exists, append the value to the end of the file
    if (!$s3ql['where']['statement_id'] && $s3ql['where']['file_name'] != '') {
        $s3qlS = compact('db', 'user_id');
        $s3qlS['from'] = 'statement';
        $where = array_filter(array_diff_key($s3ql['where'], array('value' => '')));
        $s3qlS['where'] = $where;
        $statements = S3QLaction($s3qlS);
        if (count($statements) > 1) {
            $msg = "There is more than 1 file to be updated. Plase specify statement_id where the file should be edited.";
            return $msg;
        } else {
            #find the file, open it, add the fragment and return
            $folder = $statements[0]['project_folder'];
            $maindir = $GLOBALS['s3db_info']['server']['db']['uploads_folder'] . $GLOBALS['s3db_info']['server']['db']['uploads_file'];
            $fileLocation = $maindir . '/' . $folder;
            $file_in_folder = $fileLocation . '/' . $name . '_' . $statements[0]['project_id'] . '_' . $statements[0]['item_id'] . '_' . $statements[0]['rule_id'] . '_' . strval($statements[0]['statement_id']) . '.' . $extension;
            if (is_file($file_in_folder)) {
                $a = fopen($file_in_folder, 'a');
                if (fwrite($a, $s3ql['where']['value'])) {
                    $s3ql['statement_id'] = $statements[0]['statement_id'];
                    $s3ql['file_name'] = $filename;
                    return $s3ql;
                }
            }
        }
    }
    //If we have not appended anything, create the file at this point
    //create a filekey
    $filekey = generateAFilekey(array('filename' => $filename, 'filesize' => '', 'db' => $db, 'user_id' => $user_id));
    $filedata = get_filekey_data($filekey, $db);
    //crate a new file on the s3db side
    $maindir = $GLOBALS['s3db_info']['server']['db']['uploads_folder'] . $GLOBALS['s3db_info']['server']['db']['uploads_file'];
    $fileFullName = $maindir . '/tmps3db/' . $filedata['file_id'] . '.' . $extension;
    $fileCreated = fopen($fileFullName, 'w');
    if (!$fileCreated) {
        return false;
    } else {
        fwrite($fileCreated, $s3ql['where']['value']);
        fclose($fileCreated);
        //$filedata = get_filekey_data($filekey, $db);
        //now remove the value and add the filekey to the query
        $s3ql['where'] = array_filter(array_diff_key($s3ql['where'], array('value' => '', 'file_name' => '')));
        $s3ql['where']['filekey'] = $filekey;
        return $s3ql;
    }
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:89,代码来源:move2s3db.php

示例3: Header

    Header('Location: http://' . $def . '/s3db/');
    exit;
}
$key = $_GET['key'];
#Get the key, send it to check validity
include_once '../core.header.php';
if ($key) {
    $user_id = get_entry('access_keys', 'account_id', 'key_id', $key, $db);
} else {
    $user_id = $_SESSION['user']['account_id'];
}
$args = '?key=' . $_REQUEST['key'];
$remoteelement = 'project';
$remoteelement_id = $GLOBALS['s3ids'][$remoteelement];
include '../webActions.php';
$deployment_info = URIinfo('D' . $GLOBALS['Did'], $user_id, $key, $db);
#CREATE THE HEADER AND SET THE TPL FILE
//if(!$deployment_info['add_data'])
//{
//
//echo "User cannot create projects in this Deployment";
//exit;
//}
if ($_POST['submit']) {
    $s3ql = compact('user_id', 'db');
    $s3ql['insert'] = $remoteelement;
    $s3ql['where'] = array($remoteelement_id => $_POST[$remoteelement_id]);
    $s3ql['format'] = 'html';
    $done = S3QLaction($s3ql);
    $msg = html2cell($done);
    $msg = $msg[2];
开发者ID:helenadeus,项目名称:s3db.map,代码行数:31,代码来源:remoteproject.php

示例4: Header

if (file_exists('../config.inc.php')) {
    include '../config.inc.php';
} else {
    Header('Location: http://' . $def . '/s3db/');
    exit;
}
$key = $_GET['key'];
#Get the key, send it to check validity
include_once '../core.header.php';
if ($key) {
    $user_id = get_entry('access_keys', 'account_id', 'key_id', $key, $db);
} else {
    $user_id = $_SESSION['user']['account_id'];
}
$statement_id = $_REQUEST['statement_id'];
$statement_info = URIinfo('S' . $statement_id, $user_id, $key, $db);
if (!$statement_info['delete']) {
    echo "User cannot delete this statement";
    exit;
} else {
    $project_info = get_info('project', $statement_info['project_id'], $db);
    $instance_info = get_info('instance', $statement_info['resource_id'], $db);
    $statements[0] = $statement_info;
    $statements = include_rule_info($statements, $project_id, $db);
    $statements = include_button_notes($statements, $project_id, $db);
    $statements = Values2Links($statements);
    $statement_info = $statements[0];
    #echo '<pre>';print_r($statement_info);
    if ($_POST['delete_statement'] != '') {
        $s3ql = compact('db', 'user_id');
        $s3ql['delete'] = 'statement';
开发者ID:helenadeus,项目名称:s3db.map,代码行数:31,代码来源:deletestatement.php

示例5: URIinfo

if ($class_id == '' && $project_id == '' && $_SESSION['queryresult'] == '') {
    echo $GLOBALS['messages']['something_missing'] . "<message>Please specify a class_id</message>";
    exit;
}
if ($_SESSION['queryresult'] != '') {
    $class_id = $_REQUEST['collection_id'] == '' ? $_REQUEST['class_id'] : $_REQUEST['collection_id'];
}
if ($project_id != '') {
    $project_info = URIinfo('P' . $project_id, $user_id, $key, $db);
    if (!$project_info['view']) {
        echo $GLOBALS['messages']['no_permission_message'] . '<message>User does not have permission in project</message>';
        exit;
    }
}
if ($class_id != '') {
    $class_info = URIinfo('C' . $class_id, $user_id, $key, $db);
    if (!$class_info['view']) {
        echo $GLOBALS['messages']['no_permission_message'] . '<message>User does not have permission in class</message>';
        exit;
    }
}
$s3ql = compact('db', 'user_id');
require_once 'Spreadsheet/Excel/Writer.php';
// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer();
// sending HTTP headers
// Creating a worksheet per resource
if ($class_id != '') {
    $class_id = $_REQUEST['class_id'];
    $resources[0] = $class_info;
} else {
开发者ID:helenadeus,项目名称:s3db.map,代码行数:31,代码来源:xlsproject.php

示例6: URIinfo

$project_id = $_REQUEST['project_id'];
$rule_id = $_REQUEST['rule_id'];
$class_id = $_REQUEST['collection_id'] != '' ? $_REQUEST['collection_id'] : $_REQUEST['class_id'];
$uid = 'C' . $class_id;
if ($rule_id == '' && $class_id == '') {
    echo "Please specify a class_id or a rule_id" . exit;
}
if ($rule_id != '') {
    $rule_info = URIinfo('R' . $rule_id, $user_id, $key, $db);
    if (!$rule_info['view']) {
        echo "User does not have access to this rule";
        exit;
    }
}
if ($class_id) {
    $collection_info = URIinfo('C' . $class_id, $user_id, $key, $db);
    #$pl = permission4Resource(array('uid'=>'C'.$class_id, 'shared_with'=>'U'.$user_id, 'db'=>$db, 'user_id'=>$user_id));
    #$info['C'.$class_id] = URIinfo('C'.$class_id, $user_id, $key, $db);
    #$pl = permission_level($pl,'C'.$class_id, $user_id, $db);
    if (!$collection_info['view']) {
        echo "User does not have access to this class";
        exit;
    }
}
#
#define a few usefull html vars
if ($_GET['page'] != '') {
    $_SESSION['current_page'] = $_GET['page'];
} else {
    $_SESSION['current_page'] = 1;
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:31,代码来源:query_page.php

示例7: selectQuery


//.........这里部分代码省略.........
    extract($tranformed);
    #anything that is queried must also go come out in the select
    if ($s3ql['where'] && $select != '*') {
        foreach ($s3ql['where'] as $more_outputs => $more_value) {
            if (!substr($select, $more_outputs)) {
                $select .= "," . str_replace($toreplace, $replacements, $more_outputs);
            }
        }
    }
    ##for statements, select must find file_name a well so that it is transofmred into a link
    if ($letter == 'S' && !ereg('file_name', $select)) {
        $select .= ',file_name';
    }
    $s3ql['select'] = $select;
    if ($timer) {
        $timer->setMarker('queryInterpreted');
    }
    #If there is any sort of S3 UID in the query, check its score when compared to the from
    $score = array('D' => '7', 'G' => '6', 'U' => '5', 'P' => '4', 'C' => '3', 'R' => '3', 'I' => '2', 'S' => '1');
    $fromScore = $score[strtoupper(substr($target, 0, 1))];
    $s3Ids = array_merge($GLOBALS['COREids'], array('rulelog' => 'rule_id', 'statementlog' => 'statement_id'));
    #echo '<pre>';print_r($s3ql);
    $shared_with_query = array();
    foreach ($s3Ids as $COREelement => $COREelement_id) {
        if ($s3ql['where'][$COREelement_id] != '' && !ereg('^~|regexp', $s3ql['where'][$COREelement_id])) {
            $id_name = $COREelement_id;
            $id_letter = strtoupper(substr($id_name, 0, 1));
            $whereScore[strtoupper(substr($id_name, 0, 1)) . $s3ql['where'][$COREelement_id]] = $score[strtoupper(substr($id_name, 0, 1))];
            #when idNameScore is < $fromScore, then we know: we are trying to query all resources that can view another particular resource (for example,all users that can view project x
            #echo $id_name;exit;
            $uid = strtoupper(substr($COREelement, 0, 1)) . $s3ql['where'][$COREelement_id];
            $uid_info = uid($uid);
            #Use URIinfo to find all data about this resource
            $element_info = URIinfo($uid, $user_id, $key, $db, $timer);
            $WhereInfo[$uid_info['uid']] = $element_info;
            if (!is_array($element_info)) {
                return formatReturn($GLOBALS['error_codes']['something_does_not_exist'], $uid . ' does not exist', $s3ql['format'], '');
                exit;
            } elseif ($id_letter != strtoupper(substr($element, 0, 1))) {
                ##Shared_with is any UID that can eb shared with any of the elements being requested (for example, Collection_id is shared_with Project, but Project_id is not shared  with Project
                array_push($shared_with_query, $uid);
                #do permissions on this uid propagate?
                #echo '<pre>';print_r($whereScore);exit;
            } else {
                $self_id = $s3ql['where'][$COREelement_id];
                if (!$element_info['view']) {
                    return formatReturn($GLOBALS['error_codes']['no_permission_message'], 'User does not have permission on ' . $uid, $s3ql['format'], '');
                    exit;
                }
            }
        }
    }
    #echo '<pre>';print_r($WhereInfo);exit;
    if ($self_id != '') {
        $data[0] = $element_info;
        if (ereg('^(U|G)$', $letter) && count($WhereInfo) == 2) {
            $whereId = array_diff(array_keys($WhereInfo), array($letter . $self_id));
            $D = array('shared_with' => $letter . $self_id, 'uid' => $whereId[0], 'strictsharedwith' => 1, 'strictuid' => 1, 'db' => $db, 'user_id' => $user_id, 'stream' => 'upstream', 'timer' => $timer);
            ##Look for shared_with in uid instead of uid in shared_with
            #echo 'ola';exit;
            #$data[0]['permissionOnResource']=permission4Resource($D);
            $p = array('shared_with' => $letter . $self_id, 'uid' => $whereId[0]);
            $hasP = has_permission($p, $db);
            $effective_permission_resource = permission4resource(array('user_id' => $self_id, 'shared_with' => $letter . $self_id, 'db' => $db, 'uid' => $whereId[0], 'strictsharedwith' => 1, 'strictuid' => 1, 'timer' => $timer, 'toFindInfo' => $WhereInfo[$whereId[0]]));
            if ($hasP || $effective_permission_resource != '') {
                $data[0]['permissionOnResource'] = $effective_permission_resource;
开发者ID:helenadeus,项目名称:s3db.map,代码行数:67,代码来源:S3QLaction.php

示例8: get_entry

    exit;
}
#Get the key, send it to check validity
$key = $_GET['key'];
include_once 'core.header.php';
if ($key) {
    $user_id = get_entry('access_keys', 'account_id', 'key_id', $key, $db);
} else {
    $user_id = $_SESSION['user']['account_id'];
}
$class_id = $_REQUEST['class_id'] != '' ? $_REQUEST['class_id'] : ($_REQUEST['collection_id'] != '' ? $_REQUEST['collection_id'] : $_REQUEST['entity_id']);
$uid = 'C' . $class_id;
$element = 'class';
#Universal variables
$uid_info = uid($class_id);
$resource_info = URIinfo($uid, $user_id, $key, $db);
$class_info = $resource_info;
$rule_id = $resource_info['rule_id'];
if ($_REQUEST['orderBy']) {
    $SQLextra['order_by'] = ' order by ' . $_REQUEST['orderBy'] . ' ' . $_REQUEST['direction'];
}
#Define the outgoing links there are going to exist in this page
$s3ql = compact('user_id', 'db');
$s3ql['from'] = 'users';
$s3ql['where']['class_id'] = $class_id;
$users = S3QLaction($s3ql);
$aclGrid = aclGrid(compact('user_id', 'db', 'users'));
$s3ql = compact('db', 'user_id');
$s3ql['from'] = 'rules';
$s3ql['where']['subject_id'] = $class_id;
$s3ql['where']['object'] = "!='UID'";
开发者ID:helenadeus,项目名称:s3db.map,代码行数:31,代码来源:collection.php

示例9: s3info

include 'adminheader.php';
$section_num = '2';
$website_title = $GLOBALS['s3db_info']['server']['site_title'] . ' - Edit Profile';
#if(!$_SESSION['db']){
//"How old is this key?";
#$sql = "select expires,created from s3db_access_keys where key_id='".$key."' and expires>='".date('Y-m-d H:i:s')."'";
#$db->query($sql);
#if($db->next_record()){
#$expires = $db->f('expires');
#$created = $db->f('created_on');
#}
#echo (strtotime($expires)-strtotime($created));exit;
#}
#echo '<pre>';print_r($useredited);exit;
#$useredited = s3info('user', $id, $db);
$useredited = URIinfo('U' . $id, $user_id, $key, $db);
$account_id = $id;
$imp_user_id = $id;
$account_addr_id = $useredited['account_addr_id'];
#find the groups where user belongs - the only one he can edit
$s3ql = compact('user_id', 'db');
$s3ql['select'] = '*';
$s3ql['from'] = 'groups';
$s3ql['where']['user_id'] = $user_id;
$admin_groups = S3QLaction($s3ql);
$admin_groups_ids = grab_id('group', $admin_groups);
#add admin group to the list of groups.
if ($user_id == '1') {
    $mainGroup = array('groupname' => 'Admin', 'group_id' => '1');
    if (is_array($admin_groups) && !empty($admin_groups)) {
        array_push($admin_groups, array(0 => $mainGroup));
开发者ID:helenadeus,项目名称:s3db.map,代码行数:31,代码来源:edituser.php

示例10: S3QLaction

        $s3ql['from'] = 'collections';
        $s3ql['order_by'] = 'entity';
        $allclasses = S3QLaction($s3ql);
        $object_select .= '<select name = "object_id" onChange="window.location=this.options[this.selectedIndex].value">';
        if (is_array($classes)) {
            foreach ($allclasses as $class_info) {
                $object_select .= '<option value="#' . $class_info['class_id'] . '">' . $class_info['entity'] . ' (C' . $class_info['class_id'] . ')</option>';
            }
        }
        $object_select .= '<option value="' . str_replace(array('literal_object=0', 'class_object=1'), array('', ''), $action['inspectrules']) . '&literal_object=1">(New)</option>';
        $object_select .= '<option value="' . str_replace(array('literal_object=1'), array(''), $action['inspectrules']) . '&any_class=1">(View all collections)</option>';
        $object_select .= '<option value="' . str_replace(array('&any_class=1'), array('&any_class=0'), $action['inspectrules']) . '">(View only project collections)</option>';
        $object_select .= '</select>';
    } else {
        if ($_REQUEST['rule_id']) {
            $rule_info = URIinfo('R' . $_REQUEST['rule_id'], $user_id, $key, $db);
            $selected = array('class_id' => $rule_info['object_id'], 'entity' => $rule_info['object']);
        }
        $object_select .= objectInputSelect(compact('classes', 'user_id', 'db', 'selected'));
    }
    ?>
		<script type="text/javascript">
		function  verbSelected() {
		var verb_id = document.getElementById('verb_id');
		
		var selected = verb_id.options[verb_id.selectedIndex].value;
		if (selected=='new') {
			
			document.getElementById('verb_holder').innerHTML = '<input type="text" name="verb" id="verb"><input type="button" name="edit_item_verb" value="Choose from Items" onClick="window.location=window.location.href.replace(\'literal_verb=1\',\'\').replace(\'item_verb=0\',\'\')">';

		}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:31,代码来源:ruleinspector.php

示例11: display_option


//.........这里部分代码省略.........
                            $tablecells .= 'Please insert a valid resource';
                            $tablecells .= '</font>';
                            $tablecells .= get_rule_drop_down_menu(array('select_name' => 'selectstatement_' . $row . '_' . $col, 'rule_info' => $cells['rules'][$col]['rule_info'], 'db' => $db, 'user_id' => $user_id, 'project_id' => $project_id, 'instance_id' => $row_data['instance_info']['resource_id']));
                        } else {
                            #object is a resource and instance was found
                            $tablecells .= instanceButton($IN_instance_info);
                        }
                    }
                    $tablecells .= '<br>';
                    $tablecells .= '<input type="checkbox" name="insertstatement_' . $row . '_' . $col . '" value="insertstatement_' . $row_data['instance_info']['resource_id'] . '_' . $rule_id . '" id="confirm_me' . $col . '[]" checked>';
                } elseif ($row_data[$col]['newvalue'] == '' && is_array($statement_info) && $statement_info['value'] != '') {
                    #b but not a #here is something being deleted
                    if ($statement_info['change']) {
                        if ($statement_info['file_name'] != '') {
                            $tablecells .= '<font color=red>';
                            $tablecells .= '(statement contains a file, please change it in the interface)<br /><a href=# onClick="window.open(\'' . $action['instance'] . '&instance_id=' . $statement_info['resource_id'] . '\')">Edit</a>';
                            $tablecells .= '</font>';
                        } else {
                            if ($cells['rules'][$col]['rule_info']['object_id'] == '') {
                                $tablecells .= 'old: ' . $statement_info['value'];
                            } else {
                                $OUT_instance_info = get_info('instance', $statement_info['value'], $db);
                                $tablecells .= 'old: ' . instanceButton($OUT_instance_info);
                            }
                            $tablecells .= '<br>';
                            $tablecells .= '<font color=red>';
                            $tablecells .= 'new: (empty)<br>';
                            $tablecells .= 'delete?';
                            $tablecells .= '</font>';
                            $tablecells .= '<input type="checkbox" name="deletestatement_' . $row . '_' . $col . '" value="deletestatement_' . $row_data['instance_info']['resource_id'] . '_' . $rule_id . '" id="confirm_me' . $col . '[]">';
                        }
                    } else {
                        $tablecells .= 'old: ' . $statement_info['value'];
                        $tablecells .= '<font color=red>';
                        $tablecells .= 'User does not have permission to delete statement_id ' . $statement_info['statement_id'] . '!!';
                        $tablecells .= '</font>';
                    }
                } elseif ($row_data[$col]['newvalue'] != '' && is_array($statement_info) && $statement_info['value'] == $row_data[$col]['newvalue']) {
                    #a==b nothing to change
                    if ($cells['rules'][$col]['rule_info']['object_id'] == '') {
                        $tablecells .= $statement_info['value'];
                    } else {
                        $OUT_instance_info = get_info('instance', $statement_info['value'], $db);
                        $tablecells .= instanceButton($OUT_instance_info);
                    }
                    $tablecells .= '<font color=navy>';
                    $tablecells .= '<br>';
                    $tablecells .= '(no change)';
                    $tablecells .= '</font>';
                } elseif ($row_data[$col]['newvalue'] != '' && is_array($statement_info) && $statement_info['value'] != '' && $statement_info['value'] != $row_data[$col]['newvalue']) {
                    #a!=b
                    if ($statement_info['change']) {
                        if ($statement_info['file_name'] != '') {
                            $tablecells .= '<font color=red>';
                            $tablecells .= '(statement contains a file, please change it in the interface)<br /><a href=# onClick="window.open(\'' . $action['instance'] . '&instance_id=' . $statement_info['resource_id'] . '\')">Edit</a>';
                            $tablecells .= '</font>';
                        } else {
                            if ($cells['rules'][$col]['rule_info']['object_id'] == '') {
                                $tablecells .= 'old: ' . $statement_info['value'];
                                $tablecells .= '<br>';
                                $tablecells .= 'new: ' . $row_data[$col]['newvalue'];
                            } else {
                                $OLD_instance_info = URIinfo('I' . $statement_info['value'], $user_id, $key, $db);
                                $NEW_instance_info = URIinfo('I' . $row_data[$col]['newvalue'], $user_id, $key, $db);
                                $tablecells .= 'old: ' . instanceButton($OLD_instance_info);
                                $tablecells .= '<br>';
                                if (!is_array($NEW_instance_info)) {
                                    $tablecells .= '<font color=red>';
                                    $tablecells .= '(UID ' . $row_data[$col]['newvalue'] . ' not found)';
                                    $tablecells .= '<br>';
                                    $tablecells .= 'Please insert a valid resource';
                                    $tablecells .= '</font>';
                                    $tablecells .= get_rule_drop_down_menu(array('select_name' => 'selectstatement_' . $row . '_' . $col, 'rule_info' => $cells['rules'][$col]['rule_info'], 'db' => $db, 'user_id' => $user_id, 'project_id' => $project_id, 'instance_id' => $row_data['instance_info']['resource_id']));
                                } else {
                                    $NEW_instance_info = URIinfo('I' . $row_data[$col]['newvalue'], $user_id, $key, $db);
                                    $tablecells .= 'new: ' . instanceButton($NEW_instance_info);
                                }
                            }
                            $tablecells .= '<br>';
                            $tablecells .= '<font color=DarkGreen>';
                            $tablecells .= 'edit?';
                            $tablecells .= '</font>';
                            $tablecells .= '<input type="checkbox" name="editstatement_' . $row . '_' . $col . '" value="editstatement_' . $row_data['instance_info']['resource_id'] . '_' . $rule_id . '" id="confirm_me' . $col . '[]" checked>';
                        }
                    } else {
                        $tablecells .= 'old: ' . $statement_info['value'];
                        $tablecells .= '<font color=red>';
                        $tablecells .= 'User does not have permission to delete statement_id ' . $statement_info['statement_id'] . '!!';
                        $tablecells .= '</font>';
                    }
                }
                $tablecells .= '</TD>';
            }
        }
        $tablecells .= '</TR>';
    }
    $tablecells .= '<input type="submit" name="InsertinDB" value="Import ' . $resource_info['entity'] . '"><BR>';
    $tablecells .= '</table>';
    return $tablecells;
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:101,代码来源:xlsparse.php

示例12: create_project_set

function create_project_set($P)
{
    extract($P);
    $Puid = 'P' . $project_id;
    $project_data = URIinfo($Puid, $user_id, '', $db);
    $node_set_str .= sprintf("\t%s\n", '<PROJECT>');
    $node_set_str .= sprintf("\t%s\n", '<ID>' . urlencode($project_data['project_id']) . '</ID>');
    $node_set_str .= sprintf("\t%s\n", '<NAME>' . urlencode($project_data['project_name']) . '</NAME>');
    $node_set_str .= sprintf("\t%s\n", '<DESCRIPTION>' . urlencode($project_data['project_description']) . '</DESCRIPTION>');
    #$node_set_str .= sprintf("\t%s\n", '<TOTAL_RESOURCES>'.$nr_of_resources.'</TOTAL_RESOURCES>');
    $node_set_str .= create_resource_nodes($P);
    $node_set_str .= sprintf("\t%s\n", '</PROJECT>');
    return $node_set_str;
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:14,代码来源:xmlproject.php

示例13: rootIDinfo

function rootIDinfo($s3idNames, $REQUESTdat, $argv, $user_id, $key, $db)
{
    if (!in_array('uid', array_keys($REQUESTdat))) {
        $specified_id = array_intersect($s3idNames, array_keys($REQUESTdat));
    } else {
        $specified_id = $GLOBALS['COREletterInv'][letter($REQUESTdat['uid'])];
    }
    #echo '<pre>';print_r($REQUESTdat);exit;
    if (count($specified_id) != '1') {
        if (is_array($argv)) {
            $inData = array_diff($argv, array($key, 'rdf.php'));
        }
        if (is_array($inData)) {
            foreach ($inData as $key => $value) {
                list($idname[], $id[]) = explode('=', $value);
            }
            $specified_id = array_intersect($s3idNames, $idname);
        }
        if (count($specified_id) != '1') {
            echo $GLOBALS['messages']['something_missing'] . "<message>Please specify 1 and only 1 id for the root of the ontology</message>";
            exit;
        } else {
            $inData = array_combine($idname, $id);
            $rootID = $id[0];
            $specified_id = $idname[0];
        }
    } else {
        $inData = $REQUESTdat;
        $specified_id = array_combine(array('0'), $specified_id);
        $specified_id = $specified_id[0];
        $rootID = $REQUESTdat[$specified_id];
        if ($rootID == '') {
            $rootID = ereg_replace('^' . letter($REQUESTdat['uid']), '', $REQUESTdat['uid']);
            $specified_id = $GLOBALS['COREletterInv'][letter($REQUESTdat['uid'])];
        }
    }
    $specified_id_type = array_search($specified_id, $s3idNames);
    $letter = strtoupper(substr($specified_id, 0, 1));
    $specified_id_info = URIinfo($letter . $rootID, $user_id, $key, $db);
    return compact('letter', 'specified_id', 'specified_id_type', 'specified_id_info', 'inData', 'rootID');
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:41,代码来源:rdfexport.php

示例14: create_tree_items

function create_tree_items($tree_items_file, $othervars)
{
    extract($othervars);
    $deployment_info = URIinfo('D' . $GLOBALS['Did'], $user_id, $key, $db);
    #Change the struct for project
    #wait for allprojects.php to retrieve all the projects first and put them on session :-)
    $s3ql['db'] = $db;
    $s3ql['user_id'] = $user_id;
    $s3ql['from'] = 'projects';
    $s3ql['order_by'] = 'project_id asc';
    #echo '<pre>';print_r($s3ql);
    $projects = S3QLaction($s3ql);
    #echo '<pre>';print_r($projects);
    $treeitem .= sprintf("%s\n", "var TREE_ITEMS = [ ['Projects', '" . $action['listprojects'] . "',");
    #print_r ($project_resources);
    if (is_array($projects)) {
        foreach ($projects as $project_info) {
            #$acl = find_final_acl($user_id, $project_info['project_id'], $db);
            $treeitem .= sprintf("%s\n", "['" . addslashes(urldecode($project_info['project_name'])) . "', '" . $action['project'] . "&project_id=" . $project_info['project_id'] . "',");
            #open the project
            #Create the tree node for each shared resource
            if (is_array($_SESSION[$user_id]['resources'][$project_info['project_id']])) {
                $classes = $_SESSION[$user_id]['resources'][$project_info['project_id']];
            } else {
                $s3ql = compact('user_id', 'db');
                $s3ql['select'] = '*';
                $s3ql['from'] = 'collections';
                $s3ql['where']['project_id'] = $project_info['project_id'];
                $classes = S3QLaction($s3ql);
                #echo $project_info['project_id'];echo '<pre>';print_r($classes);
                #$classes = S3QLaction($s3ql);
            }
            #echo '<pre>';print_r($classes);
            if (is_array($classes)) {
                /*$s3ql=compact('user_id','db');
                				$s3ql['select']='*';
                				$s3ql['from'] = 'rules';
                				$s3ql['where']['project_id'] = $project_info['project_id'];
                				#$s3ql['where']['object']="!='UID'";
                
                			
                			$rules = S3QLaction($s3ql);
                			#echo '<pre>';print_r($rules);
                			#separate the rules per subject
                			foreach ($rules as $rule_info) {
                				if($rule_info['object']!='UID')
                				$subject_rules['C'.$rule_info['subject_id']][] = $rule_info;
                			}
                			*/
                #echo '<pre>';print_r($subject_rules);exit;
                foreach ($classes as $resource_info) {
                    #$rule_id = get_rule_id_by_entity_id($resource_info['resource_id'],  $resource_info['project_id'], $db);
                    $treeitem .= sprintf("%s\n", "\t['" . addslashes(urldecode($resource_info['entity'])) . "', '" . $action['resource'] . "&project_id=" . $project_info['project_id'] . "&class_id=" . $resource_info['resource_id'] . "&rule_id=" . $rule_id . "',");
                    #open the resource
                    #List the rules for each shared resource
                    $rules = $subject_rules['C' . $resource_info['class_id']];
                    #Make the node for each rule
                    /*			
                    if (is_array($rules))
                    {foreach ($rules as $rule_info)
                    {$treeitem .= "		['".addslashes(urldecode($rule_info['verb']))."<B>|</B>".addslashes(urldecode($rule_info['object']))."', '".$action['querypage']."&project_id=".$project_info['project_id']."&class_id=".$resource_info['resource_id']."&rule_id=".$rule_info['rule_id']."'";#open the verb|object
                    
                    $treeitem .= sprintf("%s\n", "],"); #close the verb|object
                    
                    }
                    }
                    
                    					#Make a node for new rule
                    */
                    if ($resource_info['view']) {
                        $treeitem .= "\t\t['<I>[Query " . addslashes(urldecode($resource_info['entity'])) . "]</I>', '" . $action['querypage'] . "&class_id=" . $resource_info['resource_id'] . "&project_id=" . $project_info['project_id'] . "'";
                        #query page for class
                        $treeitem .= sprintf("%s\n", "],");
                        $treeitem .= "\t\t['<I>[List all " . addslashes(urldecode($resource_info['entity'])) . "]</I>', '" . $action['querypage'] . "&class_id=" . $resource_info['resource_id'] . "&project_id=" . $project_info['project_id'] . "&listall=yes'";
                        #list instances
                        $treeitem .= sprintf("%s\n", "],");
                    }
                    if ($resource_info['add_data']) {
                        $treeitem .= "\t\t['<I>[Add " . addslashes(urldecode($resource_info['entity'])) . "]</I>', '" . $action['insertinstance'] . "&class_id=" . $resource_info['resource_id'] . "&project_id=" . $project_info['project_id'] . "'";
                        #add instance
                        $treeitem .= sprintf("%s\n", "],");
                        $treeitem .= "\t\t['<I>[Add rule]</I>', '" . $action['createrule'] . "&project_id=" . $project_info['project_id'] . "&class_id=" . $resource_info['resource_id'] . "&rule_id=" . $rule_id . "'";
                        #open the verb|object
                        $treeitem .= sprintf("%s\n", "],");
                        #close the verb|object
                    }
                    $treeitem .= sprintf("%s\n", "\t],");
                    #close the shared resource
                    #Create a node for new resource
                }
            }
            if ($project_info['add_data']) {
                $treeitem .= sprintf("%s\n", "\t['[<I>New Collection</I>]', '" . $action['createclass'] . "&project_id=" . $project_info['project_id'] . "',");
                #open the resource
                $treeitem .= sprintf("%s\n", "\t],");
                #close the shared resource
            }
            $treeitem .= sprintf("%s\n", "],");
            #close the project
        }
//.........这里部分代码省略.........
开发者ID:helenadeus,项目名称:s3db.map,代码行数:101,代码来源:projectsTree.php

示例15: validate_access_key_inputs

function validate_access_key_inputs($I)
{
    if (is_array($I)) {
        extract($I);
    }
    if ($inputs['UID'] != '') {
        $element_info = URI($inputs['UID'], $user_id, $db);
    }
    if ($inputs['user_id'] != '') {
        $user_info = URIinfo('U' . $inputs['user_id'], $user_id, $key, $db);
    }
    if ($inputs['key_id'] == '' || $inputs['expires'] == '') {
        return 0;
    } elseif (strlen($inputs['key_id']) < 10) {
        return 1;
    } elseif (!ereg("([2-5][0-9][0-9][0-9])-([0-1][0-9])-([0-3][0-9])", $inputs['expires'])) {
        return 2;
    } elseif (access_key_exists($inputs['key_id'], $db)) {
        return 3;
    } elseif ($inputs['expires'] < date('Y-m-d')) {
        return 4;
    } elseif (htmlentities($inputs['key_id']) != $inputs['key_id']) {
        return 8;
    } elseif ($inputs['UID'] != '' && !is_array($element_info)) {
        return 6;
    } elseif ($inputs['UID'] != '' && $element_info['created_by'] != $user_id) {
        return 7;
    } elseif ($inputs['user_id'] != '' && $user_info['created_by'] != $user_id && $user_id != 1) {
        return 9;
    } else {
        return 5;
    }
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:33,代码来源:validation_engine.php


注:本文中的URIinfo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。