Пример #1
0
function Array2String($Array)
{
    if (!$Array) {
        return false;
    }
    $Return = '';
    $NullValue = "^^^";
    foreach ($Array as $Key => $Value) {
        if (is_array($Value)) {
            $ReturnValue = '^^array^' . Array2String($Value);
        } else {
            $ReturnValue = strlen($Value) > 0 ? $Value : $NullValue;
        }
        $Return .= urlencode(base64_encode($Key)) . '|' . urlencode(base64_encode($ReturnValue)) . '||';
    }
    return urlencode(substr($Return, 0, -2));
}
Пример #2
0
function Array2String($vararr)
{
    $s = '';
    $s .= '<ul>';
    while (list($header1, $value1) = each($vararr)) {
        if (is_array($value1)) {
            $s .= Array2String($value1);
        } else {
            $s .= '<li>' . $header1 . ': ' . $value1 . '</li>';
        }
    }
    return $s . '</ul>';
}
Пример #3
0
        append("Opening SubBox '" . $pimbox . $resources[$types[$i]][$z] . "'");
        $box[$types[$i]][$z] = imap_open($pimbox . $resources[$types[$i]][$z], imap_user, imap_pw) or die("Could not open: " . $pimbox . $resources[$types[$i]][$z]);
        append("Opened PIMBox for '" . $types[$i] . "/#" . $z . " as '" . $pimbox . $resources[$types[$i]][$z] . "'<br />");
    }
}
for ($i = 0; $i < count($types); $i++) {
    $res = $types[$i];
    for ($z = 0; $z < count($resources[$res]); $z++) {
        $norefresh = RetrieveVar("norefresh", "1111");
        if (!$norefresh) {
            $pbox =& $box[$res][$z];
            $info = imap_check($pbox);
            $mailamount = $info->Nmsgs;
            $list = imap_fetch_overview($pbox, "1:" . $mailamount, 0);
            emptyMirrorDir(mirror . "/" . $resources[$res][$z]);
            createMirrorDir(mirror . "/" . $resources[$res][$z]);
            append("Preparing to read " . $mailamount . " Mails from PIMBox '" . $types[$i] . "/#" . $z . "'<br />");
            for ($y = 0; $y < $mailamount; $y++) {
                $subject = $list[$y]->subject;
                $mail = imap_body($pbox, $list[$y]->uid, FT_UID);
                $f = @fopen(mirror . "/" . $resources[$res][$z] . "/" . $subject, "w");
                @fputs($f, $mail);
                @fclose($f);
            }
            append("Synced '" . $y . "' Items for Resource Type '" . $res . "'<br />\n");
        }
        analyseResource(mirror . "/" . $resources[$res][$z] . "/", $res);
    }
}
file_put_contents(restree, "<?\n\n\$GLOBALS[\"restree\"] = String2Array(\"" . Array2String($GLOBALS["restree"]) . "\");\n\n?>");
Пример #4
0
 function setRecordSet($sql = '', $values = array())
 {
     // if(!hasValue($sql)) {
     // return false;
     // }
     $sql = str_replace("TABLE_PREFIX.", $this->TABLE_PREFIX, $sql);
     if (preg_match("/^INSERT/", $sql) || preg_match("/^REPLACE/", $sql)) {
         if (count($values)) {
             $params = str_repeat('? ', count($values));
             $sql .= ' VALUES (' . str_replace(' ', ',', trim($params)) . ')';
         }
     }
     $i = 0;
     //print '<textarea cols="40" rows="4">'.$sql.'</textarea><br />';
     //print Array2String($values);
     $stmt = $this->CONN->prepare($sql);
     if (count($values)) {
         foreach ($values as $value) {
             $i++;
             $stmt->bindValue($i, $value);
         }
     }
     if ($this->LOG_TRANSACTIONS) {
         //log this transaction
         $stmt->beginTransaction();
         $stmt->execute();
         $err = $stmt->errorInfo();
         if ($err[0] != '00000') {
             $this->MESSAGE .= Array2String($err);
             //print '<textarea>'.$this->MESSAGE.'</textarea>';
             //exit;
         }
         $stmt->commit();
         return $stmt->fetchAll();
     } else {
         $stmt->execute();
         $err = $stmt->errorInfo();
         if ($err[0] != '00000') {
             $this->MESSAGE .= Array2String($err);
             // print '<textarea>'.$this->MESSAGE.'</textarea>';
             //exit;
         }
         return $stmt->fetchAll();
     }
 }
Пример #5
0
 function editPatent($data = '')
 {
     $this->checkData($data);
     if ($this->MESSAGE != '') {
         $this->MESSAGE .= Array2String($data);
         return;
     } else {
         $sql = 'UPDATE TABLE_PREFIX.PATENT SET
                 PATENT_TYPE_CD=?,PATENT_TITLE_TX=?,PATENT_OWNER_TX=?,  PATENT_ABSTRACT_TX=?,PATENT_XML_TX=?, PATENT_CREATED_DT =?, PATENT_UPDATED_DT =?, PATENT_URL_CD=?';
         $sql .= ' WHERE PATENT_ID= ? ';
         $params = array($data['PATENT_TYPE_CD'], $data['PATENT_TITLE_TX'], $data['PATENT_OWNER_TX'], $data['PATENT_ABSTRACT_TX'], $data['PATENT_XML_TX'], $data['PATENT_CREATED_DT '], $data['PATENT_UPDATED_DT '], $data['PATENT_URL_CD']);
         array_push($params, $data['PATENT_ID']);
         $results = $this->CONN->setRecordSet($sql, $params);
     }
 }