protected function loadPage()
 {
     $table = new LegalpadDocumentSignature();
     $conn_r = $table->establishConnection('r');
     $data = queryfx_all($conn_r, 'SELECT * FROM %T %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
     $signatures = $table->loadAllFromArray($data);
     return $signatures;
 }
 private function sendVerifySignatureEmail(LegalpadDocument $doc, LegalpadDocumentSignature $signature)
 {
     $signature_data = $signature->getSignatureData();
     $email = new PhutilEmailAddress($signature_data['email']);
     $doc_name = $doc->getTitle();
     $doc_link = PhabricatorEnv::getProductionURI('/' . $doc->getMonogram());
     $path = $this->getApplicationURI(sprintf('/verify/%s/', $signature->getSecretKey()));
     $link = PhabricatorEnv::getProductionURI($path);
     $name = idx($signature_data, 'name');
     $body = pht("%s:\n\n" . "This email address was used to sign a Legalpad document " . "in Phabricator:\n\n" . "  %s\n\n" . "Please verify you own this email address and accept the " . "agreement by clicking this link:\n\n" . "  %s\n\n" . "Your signature is not valid until you complete this " . "verification step.\n\nYou can review the document here:\n\n" . "  %s\n", $name, $doc_name, $link, $doc_link);
     id(new PhabricatorMetaMTAMail())->addRawTos(array($email->getAddress()))->setSubject(pht('[Legalpad] Signature Verification'))->setForceDelivery(true)->setBody($body)->setRelatedPHID($signature->getDocumentPHID())->saveAndSend();
 }
Exemplo n.º 3
0
<?php

$table = new LegalpadDocumentSignature();
$conn_w = $table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $signature) {
    echo pht("Updating Legalpad signature %d...\n", $signature->getID());
    $data = $signature->getSignatureData();
    queryfx($conn_w, 'UPDATE %T SET signerName = %s, signerEmail = %s WHERE id = %d', $table->getTableName(), (string) idx($data, 'name'), (string) idx($data, 'email'), $signature->getID());
}
Exemplo n.º 4
0
<?php

echo "Adding secretkeys to legalpad document signatures.\n";
$table = new LegalpadDocumentSignature();
$conn_w = $table->establishConnection('w');
$iterator = new LiskMigrationIterator($table);
foreach ($iterator as $sig) {
    $id = $sig->getID();
    echo "Populating signature {$id}...\n";
    if (!$sig->getSecretKey()) {
        queryfx($conn_w, 'UPDATE %T SET secretKey = %s WHERE id = %d', $table->getTableName(), Filesystem::readRandomCharacters(20), $id);
    }
}
echo "Done.\n";