コード例 #1
0
ファイル: PmaDb.class.php プロジェクト: jimrucinski/Vine
 function connect($host, $user, $password, $dbName)
 {
     $this->user = $user;
     $this->pass = $password;
     $this->dbName = $dbName;
     $this->host = $host;
     try {
         $dsn = 'mysql:host=' . $host . ';dbname=' . $dbName;
         self::$db = new PDO($dsn, $user, $password);
         self::$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } catch (PDOException $ex) {
         echo "connection error: " . $ex->getMessage();
     }
 }
コード例 #2
0
ファイル: AddTicket.php プロジェクト: jimrucinski/Vine
        $fileArray->append($fileUpload);
    }
}
$tix = new PmaTix();
$tix->first_name = $fName;
$tix->last_name = $lName;
$tix->email = $email;
$tix->request_title = $requestTitle;
$tix->request_desc = $requestDesc;
$tix->due_date = $dueDate;
$tix->request_type = $requestType;
$tix->agent = $agent;
$tix->department = $department;
$tix->logged_in_user = $logged_in_user;
try {
    $dbo = PmaPdoDb::getInstance();
    $dbo->connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    $dbo->addTicket($tix, $fileArray);
    $requestId = $dbo->resultset();
    if (count($fileArray) != 0) {
        foreach ($fileArray as $file) {
            $dbo->addSupportFile($requestId[0]['RequestId'], $file);
            $fId = $dbo->execute();
        }
    }
    if ($agent != null) {
        $sql = 'call sp_getEmail(' . $agent . ')';
        $dbo->query($sql);
        $agentEmail = $dbo->resultset();
        $addresses = array();
        $addresses[] = $agentEmail[0]['email'];
コード例 #3
0
ファイル: xfunctions.php プロジェクト: jimrucinski/Vine
function email_subscribers($post_ID)
{
    $post = get_post($post_ID);
    if ($post->post_date == $post->post_modified) {
        //run only on new post creation
        $sql = 'call sp_getSubscriberEmails()';
        $dbo = PmaPdoDb::getInstance();
        $dbo->connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
        $dbo->query($sql);
        $rows = $dbo->resultset();
        $emails = array();
        foreach ($rows as $row) {
            $emails[] = $row['user_email'];
        }
        // $author = get_user_by('id', $post->post_author );
        //echo ucwords($post->post_title) . '<br/>';
        // echo 'by: ' . $author->display_name  . '<br/>';
        $category = get_the_category($post);
        $emailCats = "";
        foreach ($category as $cat) {
            $emailCats .= '[ ' . $cat->cat_name . ' ]';
        }
        $vineImg = '<img src="http://www.pma.com/~/media/pma-images/grapevineEmailImage.png" style="float:left;" alt="PMA Grapevine" />';
        //$vineImg = '<img src="http://jxr980:8020/vinedev/wp-content/uploads/2015/07/transgrape2_small.png" style="float:left; alt="PMA Grapevine"  />';
        $emailTitle = 'New Vine Post: ' . ucwords($post->post_title);
        $postLink = '<p><a href="' . get_permalink($post_ID) . '">Read more of this post</a></>';
        $msg = '<table><tr><td>' . $vineImg . '</td><td style="font-family:calibri; width:120px;valign:middle;text-align:left;"><H3>' . ucwords($post->post_title) . '</H3><h5>' . $emailCats . '</h5></td></tr>';
        $msg .= '<tr><td style="font-family:calibri;" colspan="2">' . get_excerpt_by_id($post) . $postLink . '</td></tr></table>';
        //echo $post->post_type;
        //echo $msg;
        //echo $post->post_date . '<br/>' . $post->post_modified . '<br/>';
        //die();
        sendMail($emailTitle, $msg, $emails, false, 'PMA Grapevine');
        return $post_ID;
    }
}
コード例 #4
0
ファイル: xPMA_Specific.php プロジェクト: jimrucinski/Vine
function pmaGetWorkRequest()
{
    global $wp;
    //handle file delete request
    if (isset($_REQUEST['SupportFile'])) {
        try {
            $curUser = $current_user->user_login;
            $currentWID = $_REQUEST['workrequestid'];
            $delId = $_REQUEST['SupportFile'];
            $sql = 'call sp_deleteSupportFile(' . $currentWID . ',' . $delId . ',"' . $curUser . '")';
            $dbo = PmaPdoDb::getInstance();
            $dbo->connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
            $dbo->query($sql);
            $rs = $dbo->execute();
        } catch (Exception $exp) {
            echo "EXCEPTION:<br/>" . $exp . message;
            die;
        }
    }
    if (isset($_REQUEST['workrequestid'])) {
        $wid = $_GET["workrequestid"];
    } else {
        return "<h4>There was no ID passed to the page, therefore no records found.</h4>";
    }
    $sql = 'call sp_getWorkRequest(' . $wid . ')';
    $dbo = PmaPdoDb::getInstance();
    $dbo->connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    $rows = $dbo->queryForObjs($sql);
    //store orginal values in session
    session_start();
    $_SESSION['OriginalTicketVals'] = $rows;
    $str = '<div style="float:right"><font class="ChangeLogHeader">Change Log</font></div>';
    $str .= '<h4>Work Request: ' . $wid . '</h4>';
    //echo strlen($rows[0]['ticketlog']);
    //die();
    // if(!empty($rows[0]['ticketlog'])){
    // $str .='<div><div id="log" style="">' . $rows[0]['ticketlog'] . '</div></div>';
    // }
    // else{
    //     $str .='<div id="log" style="">no log found</div>';
    // }
    $str .= '<script type="text/javascript">function checkFiles(){var F = document.getElementById("upload_file");if("files" in F){var s=0;for (var i = 0; i < F.files.length; i++){var file = F.files[i];s+=file.size;}};if(s > 8388608){alert("Total File Size is Greater Than Allowable 8 Meg Limit");return false;}else{return true;}}</script>';
    $str .= '<form onsubmit="return checkFiles();" action="../../../PMA/EditTicket.php" method="POST" name="EditTicket" id="EditTicket" enctype="multipart/form-data">';
    $str .= '<div style="float:left;width:60%;"><fieldset style="position:relative;width:100%;" ><ul class="PmaSupportTicket">';
    foreach ($rows as $row) {
        $str .= '<li><label>Name</label>';
        $str .= $row['first_name'] . ' ' . $row['last_name'] . '</li><li><label>email</label><a href="mailto://' . $row['email'] . '">' . $row['email'] . '</a></li><li><label>date submitted</label>' . $row['date_submitted'] . '</li>';
        $str .= '<li><label>due date</label>' . $row['due_date'] . '</li>';
        $str .= '<li><label>assigned to</label>' . do_shortcode("[PMA-RequestSelectBox sp='sp_getTicketAgents' id=1 nme='agent' keepvalue=" . $row['agent'] . " emptyTopValue=false)]");
        '</li>';
        $str .= '<li><label>status</label>' . do_shortcode("[PMA-RequestSelectBox sp='sp_getStatusTypesForEdit' id=1 nme='status' keepvalue=" . $row['status'] . ']');
        '</li>';
        $str .= '<li><label>request type</label>' . do_shortcode("[PMA-RequestSelectBox sp='sp_getDeptRequestTypes' id=1 nme='requestType' keepvalue=" . $row['request_type'] . " emptyTopValue=false)]");
        '</li>';
        $str .= pmaCreateInputBox('requestTitle', $row['request_title']);
        $str .= '<li><label>description</label><p style="display:inline-block;">' . $row['request_desc'] . '</p></li>';
        $str .= '<li><label>support files</label><input type="file" id="upload_file" name="upload_file[]" multiple=""/></li>';
        $str .= '<li><label>comment</label><textarea id="comments" name="comments" rows="3" style="width:500px;"></textarea>';
        $str .= '<li><label>&nbsp;</label><input type="submit" value="submit" id="go" name="go" /></li>';
    }
    $str .= '</ul></fieldset></div></div>';
    $str .= '</form>';
    //start Change Log
    $ticketlog = 'call sp_getTicketLog(' . $wid . ')';
    $dbo->query($ticketlog);
    $log = $dbo->resultset();
    if (!empty($log)) {
        $str .= '<a target ="new" href="../../../PMA/PrintLog.php?workrequestid=' . $wid . '">print log</a><br/>';
        $str .= '<div class="log">';
        foreach ($log as $l) {
            $str .= '<div><strong>' . $l[tstamp] . ': ' . $l["user"] . '</strong><br/>' . $l["ticket_comment"] . '</div>';
        }
        $str .= '</div>';
    } else {
        $str .= '<div class="log" style="background-color:#666666;color:#ffffff;text-align:center;">no log found</div>';
    }
    //start File Attachments
    $attachments = 'call sp_getTicketFileAttachments(' . $wid . ')';
    $dbo->query($attachments);
    $fas = $dbo->resultset();
    //echo 'it = ' . $fas->fetchColumn();
    if (!empty($fas)) {
        $str .= '<div id="supportTix"><font class="ChangeLogHeader" style="text-align:left;">Support Documents</font>';
        foreach ($fas as $fa) {
            $str .= '<div id="supportFiles"><a onclick="return confirm(\'Are you sure you want to delete the selected support document: ' . $fa['fileName'] . '?\');" href=".?workrequestid=' . $wid . '&SupportFile=' . $fa['id'] . '"><img title="Delete ' . $fa['fileName'] . '"  src="' . get_option("siteurl") . '/PMA/delete-icon.png"/></a><a title="Download ' . $fa['fileName'] . '" href="' . get_option("siteurl") . '/PMA/PmaGetFile.php?id=' . $fa['id'] . '">' . $fa['fileName'] . '</a></div>';
        }
        $str .= '</div>';
    }
    return $str;
}