Example #1
0
/**
 * Создаёт заказ по данным из mysql
 *
 * @param array $data данные из mysql
 *
 * @return &array объект заказа
 */
function &unserializeFromMysql(array $data)
{
    $Order =& construct();
    setId($Order, $data['id']);
    setPrice($Order, $data['price']);
    setText($Order, $data['text']);
    return $Order;
}
Example #2
0
    imageBoldLine($bcg, $x * $wsp, $y * $wsp + imagesy($thumb), $x * $wsp + imagesx($thumb), $y * $wsp + imagesy($thumb), $black, 2);
    /*		RIGHT	*/
    imageBoldLine($bcg, $x * $wsp + imagesx($thumb), $y * $wsp, $x * $wsp + imagesx($thumb), $y * $wsp + imagesy($thumb), $black, 2);
}
function setText($x, $y, $text)
{
    global $bcg, $wsp;
    $bbox = imagettfbbox(10, 0, 'arial.ttf', $text);
    $fontColor = ImageColorAllocate($bcg, 0, 0, 0);
    $im = imagecreatetruecolor(abs($bbox[0]) + abs($bbox[2]) + 8, abs($bbox[1]) + abs($bbox[7]) + 8);
    $white = imagecolorallocatealpha($im, 255, 255, 255, 0);
    imagefilledrectangle($im, 1, 1, abs($bbox[0]) + abs($bbox[2]) + 6, abs($bbox[1]) + abs($bbox[7]) + 6, $white);
    imagecopymerge($bcg, $im, $x * $wsp, $y * $wsp, 0, 0, imagesx($im), imagesy($im), 100);
    ImageTTFText($bcg, 10, 0, $x * $wsp + 3, $y * $wsp + 14, $fontColor, 'arial.ttf', $text);
}
$tab_text = json_decode($_POST['texts']);
if (count($tab_text) > 0) {
    for ($i = 0; $i < count($tab_text); $i++) {
        setText($tab_text[$i]->x, $tab_text[$i]->y, $tab_text[$i]->text);
    }
}
$tab_image = json_decode($_POST['images']);
if (count($tab_image) > 0) {
    for ($i = 0; $i < count($tab_image); $i++) {
        setImage($tab_image[$i]->x, $tab_image[$i]->y, 'cache/' . $tab_image[$i]->filename);
    }
}
@imagejpeg($bcg, 'cache/' . $_POST['filename'], 100);
@imagedestroy($thumb);
@imagedestroy($img);
@imagedestroy($bcg);
Example #3
0
const SPARKLE_NS = "http://www.andymatuschak.org/xml-namespaces/sparkle";
if (!file_exists($archivepath)) {
    throw new Exception("Can't find {$archivepath}");
}
$feed = new DOMDocument();
$feed->load($appcastpath);
$xp = new DOMXPath($feed);
$xp->registerNamespace("sparkle", SPARKLE_NS);
$item = $xp->query("//item[enclosure/@sparkle:version='{$exactVersion}']")->item(0);
if (!$item) {
    $item = getElement($feed->getElementsByTagName('channel')->item(0), "item");
    newline($item);
}
setText(getElement($item, "title"), "Version {$niceVersion}");
setText(getElement($item, "pubDate"), date(DATE_RSS));
setText(getElement($item, "sparkle:minimumSystemVersion", SPARKLE_NS), $minOSVersion);
getElement($item, "description");
$enc = getElement($item, "enclosure");
$enc->setAttributeNS(SPARKLE_NS, "sparkle:version", $exactVersion);
$enc->setAttribute("url", $download_url);
$enc->setAttribute("length", filesize($archivepath));
$enc->setAttributeNS(SPARKLE_NS, "sparkle:dsaSignature", signUpdate($archivepath, $pempath));
file_put_contents($appcastpath, $feed->saveXML());
function readKey($name)
{
    $plistpath = realpath('Info.plist');
    $domain = preg_replace('/\\.plist$/', '', $plistpath);
    return system("defaults read " . escapeshellarg($domain) . " " . escapeshellarg($name));
}
function getElement(DOMElement $parent, $tagname, $ns = NULL)
{
Example #4
0
 public function __construct()
 {
     setQuantity();
     setLorem_type();
     setText();
 }