Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def doAction(user,kwik,action,design)
- postID = templateNumToPageID(design)
- if user.present?
- cpanelInfo = []
- Net::SSH.start('207.58.161.120', 'root', :password => "Nomorechip!!!23", :port => 8765) do |ssh|
- ssh.exec!("cd /home/#{user}/public_html && wp config get --format=json --allow-root") do
- |ch, stream, line|
- output = line
- if JSON.is_json?(output)
- #puts output
- begin
- out = JSON.generate(output)
- out = JSON.parse(output)
- #puts out[3]['value']
- prefix = out[0]['value']
- dbName = out[3]['value']
- dbUser = out[4]['value']
- dbPass = out[5]['value']
- cpanelInfo << {'prefix' => prefix.to_s, 'dbName' => dbName.to_s, 'dbUser' => dbUser.to_s, 'dbPass' => dbPass.to_s}
- #puts cpanelInfo
- rescue JSON::ParserError => e
- # do smth
- puts e
- end
- end
- end
- #puts cpanelInfo
- cpanelInfo.each do |c|
- postContent = '[vc_row][vc_column][vc_column_text]<img src="http://d2xcg9rrwac7gn.cloudfront.net/polished_pro/Kwik.png" alt="" /> <strong>can help make your purchase even easier.</strong>
- [/vc_column_text][vc_column_text]You don’t have to let aa small budget keep you from being comfortable in your home.* Now that [brand] offers special financing options from Synchrony Bank, expand your purchasing power and convenience with:
- <ul>
- <li>Convenient monthly payment options</li>
- <li>Competitive interest rates</li>
- <li>No prepayment penalties</li>
- <li>A simple application process and fast credit decisions</li>
- <li>Unsecured, generous revolving credit lines</li>
- <li>Open credit line for future purchases</li>
- </ul>
- And unlike Visa®, MasterCard and other bank cards, KwikComfort Financing provides multiple promotional financial options, including:
- <ul>
- <li>Deferred interest</li>
- <li>No interest with equal monthly payments</li>
- <li>Fixed payment with interest plans offering APRs and interest rates much lower than most bank card rates</li>
- </ul>
- [/vc_column_text][vc_column_text]
- <p style="font-size: 10px;">*Subject to credit approval. Minimum monthly payments required. See contractor for details.</p>
- [/vc_column_text][vc_column_text]Applying online is quick, secure and private. To apply for a credit card, simply complete the <a id="textlink" href="https://etail.mysynchrony.com/eapply/eapply.action?mid='+kwik+'&pcgc=M900">online credit application</a>. You will be able to read the privacy policy and review the terms of this offer before submitting the online application.[/vc_column_text][vc_empty_space][vc_cta h2="Applying Online is quick, secure and private. " add_button="bottom" btn_title="Apply Here" btn_link="url:https%3A%2F%2Fetail.mysynchrony.com%2Feapply%2Feapply.action%3Fmid%3D'+kwik+'%26pcgc%3DM900|title:Apply%20Online|target:%20_blank" btn_add_icon="true"]To apply for a credit card, simply complete the online credit application. You will be able to read the privacy policy and review the terms of this offer before submitting the online application.[/vc_cta][/vc_column][/vc_row]'
- postContent = postContent.to_s
- dbName = c['dbName']
- dbUser = c['dbUser']
- dbPass = c['dbPass']
- prefix = c['prefix']
- puts prefix
- if prefix.include? '_'
- else
- prefix = prefix + '_'
- end
- if action
- #edit the page
- ssh.exec!("mysql --host=localhost --user=#{dbUser} --password=#{dbPass} --database=#{dbName} -e \"UPDATE #{prefix}posts SET post_content='#{postContent}' WHERE id='#{postID}'\" ") do |ch, stream, line|
- puts line
- end
- else #draft the pg
- ssh.exec!("mysql --host=localhost --user=#{dbUser} --password=#{dbPass} --database=#{dbName} -e \"UPDATE #{prefix}posts SET post_status='draft' WHERE id='#{postID}'\" ") do |ch, stream, line|
- puts line
- end
- end
- ssh.exec!("wp w3-total-cache flush all") do |ch, stream, line|
- puts line
- end
- end
- #$ssh
- #maybe also get kwik info before
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement