예제 #1
0
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
if ($result) {
    while ($row = mysql_fetch_assoc($result)) {
        $temperature = $row["temperature"];
        $count = $row["currtime"];
        //add to data areray
        $dataArray[$count] = $temperature;
        print '<p>';
        print 'temperature=' . $row['temperature'];
        print 'id=' . $row['id'];
        print ',currtime=' . $row['currtime'];
        print '</p>';
    }
}
//setup graph
$graph = new stdclass();
$graph->width = 500;
$graph->height = 350;
//$graph->data=array('AL'=>3731, 'MI'=>763, 'NY'=>3245, 'TX'=>4373, 'WA'=>12124, 'WY'=>5535);
$graph->data = $dataArray;
//$graph->setGradient = array('red', 'maroon');
$graph->setLegend = 'true';
$graph->setLegendTitle = 'Widgets';
$graph->setBars(false);
$graph->setLine(true);
$graph->setDataPoints(true);
$graph->setDataPointColor('maroon');
$graph->setDataValues(true);
$graph->setDataValueColor('maroon');
$graph->setGoalLine(0.0025);
$graph->setGoalLineColor('red');
예제 #2
0
function plagiarism_urkund_get_file_object($plagiarismfile)
{
    global $CFG, $DB;
    if (strpos($plagiarismfile->identifier, $CFG->tempdir) === true) {
        // This is a stored text file in temp dir.
        $file = new stdclass();
        if (file_exists($plagiarismfile->identifier)) {
            $file->type = "tempurkund";
            $file->filename = basename($plagiarismfile->identifier);
            $file->timestamp = time();
            $file->identifier = sha1(file_get_contents($plagiarismfile->identifier));
            $file->filepath = $plagiarismfile->identifier;
            // Sanity check to see if the Sha1 for this file has already been sent to urkund using a different record.
            if ($DB->record_exists('plagiarism_urkund_files', array('identifier' => $file->identifier, 'cm' => $plagiarismfile->cm, 'userid' => $plagiarismfile->userid))) {
                // This file has already been sent and multiple records for this file were created
                // Delete plagiarism record and file.
                $DB->delete_records('plagiarism_urkund_files', array('id' => $plagiarismfile->id));
                debugging("This file has been duplicated, deleting the duplicate record. Identifier:" . $file->identifier);
                unlink($plagiarismfile->identifier);
                // Delete temp file as we don't need it anymore.
                return false;
            }
            return $file;
        } else {
            debugging("The local version of this file has been deleted, and this file cannot be sent");
            return false;
        }
    } else {
        $cm = get_coursemodule_from_id('', $plagiarismfile->cm);
        $modulecontext = context_module::instance($plagiarismfile->cm);
        $fs = get_file_storage();
        if ($cm->modname == 'assign') {
            require_once $CFG->dirroot . '/mod/assign/locallib.php';
            $assign = new assign($modulecontext, null, null);
            if ($assign->get_instance()->teamsubmission) {
                $submission = $assign->get_group_submission($plagiarismfile->userid, 0, false);
            } else {
                $submission = $assign->get_user_submission($plagiarismfile->userid, false);
            }
            $submissionplugins = $assign->get_submission_plugins();
            foreach ($submissionplugins as $submissionplugin) {
                $component = $submissionplugin->get_subtype() . '_' . $submissionplugin->get_type();
                $fileareas = $submissionplugin->get_file_areas();
                foreach ($fileareas as $filearea => $name) {
                    $files = $fs->get_area_files($assign->get_context()->id, $component, $filearea, $submission->id, "timemodified", false);
                    foreach ($files as $file) {
                        if ($file->get_contenthash() == $plagiarismfile->identifier) {
                            return $file;
                        }
                    }
                }
            }
        } else {
            if ($cm->modname == 'workshop') {
                require_once $CFG->dirroot . '/mod/workshop/locallib.php';
                $cm = get_coursemodule_from_id('workshop', $plagiarismfile->cm, 0, false, MUST_EXIST);
                $workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
                $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
                $workshop = new workshop($workshop, $cm, $course);
                $submissions = $workshop->get_submissions($plagiarismfile->userid);
                foreach ($submissions as $submission) {
                    $files = $fs->get_area_files($workshop->context->id, 'mod_workshop', 'submission_attachment', $submission->id);
                    foreach ($files as $file) {
                        if ($file->get_contenthash() == $plagiarismfile->identifier) {
                            return $file;
                        }
                    }
                }
            } else {
                if ($cm->modname == 'forum') {
                    require_once $CFG->dirroot . '/mod/forum/lib.php';
                    $cm = get_coursemodule_from_id('forum', $plagiarismfile->cm, 0, false, MUST_EXIST);
                    $posts = forum_get_user_posts($cm->instance, $plagiarismfile->userid);
                    foreach ($posts as $post) {
                        $files = $fs->get_area_files($modulecontext->id, 'mod_forum', 'attachment', $post->id, "timemodified", false);
                        foreach ($files as $file) {
                            if ($file->get_contenthash() == $plagiarismfile->identifier) {
                                return $file;
                            }
                        }
                    }
                }
            }
        }
    }
}
예제 #3
0
/**
 * Determine if dir path exists or not in repository
 *
 * @param string   $dirpath
 * @param stdclass $repository
 * @param boolean  $encodepath
 * @param array    $params
 * @return boolean true if dir path exists in repository, false otherwise
 */
function hotpot_pluginfile_dirpath_exists($dirpath, $repository, $encodepath, $params)
{
    $dirs = explode('/', $dirpath);
    foreach ($dirs as $i => $dir) {
        $dirpath = implode('/', array_slice($dirs, 0, $i));
        if ($encodepath) {
            $params['filepath'] = '/' . $dirpath . ($dirpath == '' ? '' : '/');
            $params['filename'] = '.';
            // "." signifies a directory
            $dirpath = file_storage::pack_reference($params);
        }
        $exists = false;
        $listing = $repository->get_listing($dirpath);
        foreach ($listing['list'] as $file) {
            if (empty($file['source'])) {
                if ($file['title'] == $dir) {
                    $exists = true;
                    break;
                }
            }
        }
        if (!$exists) {
            return false;
        }
    }
    // all dirs in path exist - success !!
    return true;
}
예제 #4
0
<?php

crypt();
\crypt();
\crypt(1);
crYpt(2, 3);
crypt(4, 5, 6, 7);
\crypt(4, 5, 6, 8);
CRYpt(4, 5, 6, 9);
unknown_function(1, 2, 3, 4, 5);
$x->phpinfo(1, 2, 3);
stdclass::assert_options(6, 7, 8, 9);