Ejemplo n.º 1
0
function generate_thumbnail($sURL, $needConnect)
{
    if (!is_logged_in()) {
        return getError("no logged-in user");
    }
    $res = array();
    //get picture from service
    //"http://www.sitepoint.com/forums/image.php?u=106816&dateline=1312480118";
    $remote_path = str_replace("[URL]", $sURL, WEBSITE_THUMBNAIL_SERVICE);
    $heurist_path = tempnam(HEURIST_FILESTORE_DIR, "_temp_");
    // . $file_id;
    $filesize = saveURLasFile($remote_path, $heurist_path);
    if ($filesize > 0) {
        //check the dimension of returned thumbanil in case it less than 50 - consider it as error
        if (strpos($remote_path, substr(WEBSITE_THUMBNAIL_SERVICE, 0, 24)) == 0) {
            $image_info = getimagesize($heurist_path);
            if ($image_info[1] < 50) {
                //remove temp file
                unlink($heurist_path);
                return getError("Thumbnail generator service can't create the image for specified URL");
            }
        }
        $fileID = upload_file("snapshot.jpg", "jpg", $heurist_path, null, $filesize, $sURL, $needConnect);
        if (is_numeric($fileID)) {
            $res = get_uploaded_file_info($fileID, $needConnect);
        } else {
            $res = getError("File upload was interrupted. " . $fileID);
        }
    } else {
        $res = getError("Cannot download image");
    }
    return $res;
}
Ejemplo n.º 2
0
function copyRectypeIcon($source_RtyID, $target_RtyID, $thumb = "")
{
    global $sourceIconURL;
    $sourceURL = $sourceIconURL . $thumb . $source_RtyID . ".png";
    $targetPath = HEURIST_ICON_DIR . $thumb . $target_RtyID . ".png";
    //print "<br>sourcce=".$sourceURL;
    //print "<br>path=".$targetPath;
    saveURLasFile($sourceURL, $targetPath);
    if ($thumb == "") {
        copyRectypeIcon($source_RtyID, $target_RtyID, "thumb/th_");
    }
}
Ejemplo n.º 3
0
        $file = fopen ($folder."/".HEURIST_DBNAME.".xml", "w");
        if(!$file){
            die("Can't write ".HEURIST_DBNAME."xml file. Please ask sysadmin to check permissions");
        }
        fwrite($file, $content);
        fclose ($file);
        */
 }
 //export HML
 // Export database definitions as readable text
 echo_flush("Exporting database definitions as readable text<br>");
 $url = HEURIST_BASE_URL . "admin/describe/getDBStructureAsSQL.php?db=" . HEURIST_DBNAME . "&pretty=1";
 saveURLasFile($url, $folder . "/Database_Structure.txt");
 echo_flush("Exporting database definitions as XML<br>");
 $url = HEURIST_BASE_URL . "admin/describe/getDBStructureAsXML.php?db=" . HEURIST_DBNAME;
 saveURLasFile($url, $folder . "/Database_Structure.xml");
 if (is_admin()) {
     // Do an SQL dump of the whole database
     echo_flush("Exporting SQL dump of the whole database<br>");
     try {
         $dump = new Mysqldump(DATABASE, ADMIN_DBUSERNAME, ADMIN_DBUSERPSWD, HEURIST_DBSERVER_NAME, 'mysql', array('skip-triggers' => true, 'add-drop-trigger' => false));
         $dump->start($folder . "/" . HEURIST_DBNAME . "_MySQL_Database_Dump.sql");
     } catch (Exception $e) {
         if (file_exists($progress_flag)) {
             unlink($progress_flag);
         }
         print '</div><script>document.getElementById("divProgress").style.display="none";</script>';
         die("<h2>Error</h2>Unable to generate MySQL database dump." . $e->getMessage() . $please_advise);
     }
 }
 //this coode not used anymore - we copy entire content of file_uploads