Example #1
0
function yambeSetParent(&$textbox, &$title)
{
    global $URLSplit;
    $parent = explode($URLSplit, $_SERVER['HTTP_REFERER']);
    // If the code breaks on this line check declaration of $URLSplit on line 23 matches your wiki
    $page = splitName($parent[1]);
    $par = getTagFromParent($page['title'], $page['namespaceid']);
    if ($par['exists']) {
        if ($par['self'] != "") {
            $display = $par['self'];
        } else {
            $display = str_replace("_", " ", $page['title']);
        }
        $textbox = "<yambe:breadcrumb>{$parent['1']}|{$display}</yambe:breadcrumb>";
    }
    return true;
}
             break;
         }
     } else {
         if ($field["Path"] == $value["path"][0]) {
             $found = 1;
             break;
         }
     }
 }
 if (!$found) {
     //                $result = mysql_query("SELECT count(*) FROM files WHERE Path='".addslashes($value["path"][0])."' OR Path LIKE '".addslashes($value["path"][0])."/%'");
     //                if ($result && ($field = mysql_fetch_row($result)) && ($field[0]==0) && (!in_array ($value["path"][0]."/",$config['rootdir']))){
     $result = mysql_query("SELECT count(*) FROM incoming WHERE Path='" . addslashes(implode("\r\n", $value["path"])) . "'");
     if ($result && ($field = mysql_fetch_row($result)) && $field[0] == 0) {
         $path_parts = pathinfo(substr($key, 0, -1));
         $names = splitName($path_parts["basename"]);
         $hide = 0;
         if (@$path_parts["extension"] == 'info') {
             $hide = 1;
         }
         $result = mysql_query("INSERT INTO incoming(Path,EngName,RusName,VideoInfo,AudioInfo,RusVariants,ImdbVariants,GoogleImageVariants,imdbPersones,imdbCountries,imdbDesription,imdbGenres,rusCountries,rusGenres,rusCompanies,rusDescription,rusPersones,Hide) VALUES('" . addslashes(implode("\r\n", $value["path"])) . "','" . addslashes($names["eng"]) . "','" . addslashes($names["rus"]) . "','','','','','','','','','','','','','','',{$hide})");
     }
     $sql = "SELECT * FROM incoming WHERE Path='" . addslashes(implode("\r\n", $value["path"])) . "'";
     $result = mysql_query($sql);
     if ($result && ($field = mysql_fetch_assoc($result)) && $field["Hide"] == 0) {
         $file_info = preg_replace($config['multipathpattern'], "", $value["path"][0]) . ".info";
         $file_info = $storages->decode_path($file_info);
         if (!preg_match('/ftp:\\/\\//', $value["path"][0]) && !$field["rusParsed"] && !$field["imdbParsed"] && !$field["RusUrlParse"] && !$field["ImdbUrlParse"] && file_exists($file_info)) {
             require_once dirname(__FILE__) . "/common/xml/xml.php";
             $xml = new XML();
             $info = $xml->xml_to_array("<?xml version=\"1.0\" encoding=\"windows-1251\"?>" . implode("", file($file_info)));
Example #3
0
 /**
  * Take in huge flat array, turn into heirarchy
  * We get a==>b as the name, we need a key for a and b in the array
  * to get exclusive values for A we need to subtract the values of B (and any other children);
  * call passing in the entire profile only, should return an array of
  * functions with their regular timing, and exclusive numbers inside ['exclusive']
  *
  * Consider:
  *              /---c---d---e
  *          a -/----b---d---e
  *
  * We have c==>d and b==>d, and in both instances d invokes e, yet we will
  * have but a single d==>e result. This is a known and documented limitation of XHProf
  *
  * We have one d==>e entry, with some values, including ct=2
  * We also have c==>d and b==>d
  *
  * We should determine how many ==>d options there are, and equally
  * split the cost of d==>e across them since d==>e represents the sum total of all calls.
  *
  * Notes:
  *  Function names are not unique, but we're merging them
  *
  * @return Xhgui_Profile A new instance with exclusive data set.
  */
 public function calculateExclusive()
 {
     $run = $this->_data['profile'];
     $final = array();
     $totaler = function ($a, $b) {
         $c = array();
         foreach ($a as $k => $v) {
             $c[$k] = $v + $b[$k];
         }
         return $c;
     };
     //Create a list of each function
     foreach ((array) $run as $name => $data) {
         list($parent, $child) = splitName($name);
         //Init exclusive values
         $data['ewt'] = $data['wt'];
         $data['emu'] = $data['mu'];
         $data['ecpu'] = $data['cpu'];
         $data['ect'] = $data['ct'];
         $data['epmu'] = $data['pmu'];
         // Set parent
         $data['parent'] = $parent;
         if (!isset($final[$child])) {
             // Save all this data as the child function,
             // this is wrong (since we'll clobber something
             // if the same function is called from two places)
             $final[$child] = $data;
         } else {
             $final[$child] = $totaler($final[$child], $data);
         }
     }
     // Delete from parent its children, this is wrong
     foreach ($final as $child => $data) {
         if (isset($final[$data['parent']])) {
             $final[$data['parent']]['ewt'] -= $data['wt'];
             $final[$data['parent']]['emu'] -= $data['mu'];
             $final[$data['parent']]['ecpu'] -= $data['cpu'];
             $final[$data['parent']]['ect'] -= $data['ct'];
             $final[$data['parent']]['epmu'] -= $data['pmu'];
         }
     }
     return new self(array('meta' => $this->_data['meta'], 'profile' => $final));
 }
Example #4
0
function fixAdvisorFile(&$studentInfo, &$staffInfo)
{
    $fdRead = fopen('0910_Advisors.csv', 'r');
    $fdWrite = fopen('0910_Advisors_FIX.csv', 'w');
    if (!$fdRead) {
        echo "Could not read file\n";
        exit;
    }
    // read first line
    $fields = fgetcsv($fdRead);
    while ($fields = fgetcsv($fdRead)) {
        if (!array_key_exists($fields[1], $studentInfo)) {
            echo "FATAL STUDENT ID DOES NOT EXISTS: " . implode(',', $fields) . "\n";
            exit;
        }
        if ($studentInfo[$fields[1]]['grade'] != $fields[0]) {
            echo "FATAL STUDENT ID GRADE DOES NOT MATCH: " . implode(',', $fields) . "\n";
            exit;
        }
        if (strpos($fields[2], ' / ') !== false) {
            $advisors = splitName($fields[2], '/');
            $advisor_1 = splitName($advisors[0]);
            $advisor_2 = splitName($advisors[1]);
        } else {
            $advisor_1 = splitName($fields[2]);
            $advisor_2 = array('', '');
        }
        $advisor_1_id = $advisor_2_id = '';
        if (!array_key_exists("{$advisor_1[1]} {$advisor_1[0]}", $staffInfo)) {
            echo "FATAL ADVISOR 1 INFO NOT FOUND: " . implode(',', $fields) . "\n";
            exit;
        }
        $advisor_1_id = $staffInfo["{$advisor_1[1]} {$advisor_1[0]}"]['id'];
        if (!empty($advisor_2[0])) {
            if (!array_key_exists("{$advisor_2[1]} {$advisor_2[0]}", $staffInfo)) {
                echo "FATAL ADVISOR 2 INFO NOT FOUND: " . implode(',', $fields) . "\n";
                exit;
            }
            $advisor_2_id = $staffInfo["{$advisor_2[1]} {$advisor_2[0]}"]['id'];
        }
        $newFields = array($studentInfo[$fields[1]]['first_name'], $studentInfo[$fields[1]]['last_name'], 'Student-' . $fields[1], $advisor_1[0], $advisor_1[1], $advisor_1_id, $advisor_2[0], $advisor_2[1], $advisor_2_id);
        fputcsv($fdWrite, $newFields);
    }
    fclose($fdRead);
    fclose($fdWrite);
}