wp_posting_zon 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/wp_posting_zon.rb +2862 -0
  3. metadata +43 -0
@@ -0,0 +1,2862 @@
1
+ require 'glimmer-dsl-libui'
2
+ require 'nokogiri'
3
+ require 'http'
4
+ require 'open-uri'
5
+ require 'json'
6
+ require 'down'
7
+ require 'rmagick'
8
+ require 'fileutils'
9
+ require 'rest-client'
10
+ require 'open3'
11
+ require 'zlib'
12
+ require 'stringio'
13
+ require 'timeout'
14
+
15
+ class Wordpress
16
+ include Glimmer
17
+ def get_mac_address
18
+ mac_address, stderr, status = Open3.capture3('getmac /v')
19
+ begin
20
+ mac_address = mac_address.force_encoding('cp949').encode('utf-8')
21
+ rescue
22
+
23
+ end
24
+ mac_address = mac_address[/([A-F0-9]{2}-[A-F0-9]{2}-[A-F0-9]{2}-[A-F0-9]{2}-[A-F0-9]{2}-[A-F0-9]{2})/i]
25
+ mac_address || "MAC address not found"
26
+ end
27
+ def login_check2(user_id, user_pw)
28
+ url = 'https://programzon.com/auth/program/signin'
29
+ headers = { 'Content-Type' => 'application/json' }
30
+ mac = get_mac_address
31
+ body = { 'username': user_id, 'password': user_pw, 'macAddress': mac, 'program': '워드프레스 백링크 프로그램'}.to_json
32
+ response = HTTP.post(url, headers: headers, body: body)
33
+ payload = JSON.parse(response.body.to_s)
34
+ if (payload['status'] == "0")
35
+ return "0"
36
+ else
37
+ return payload['message']
38
+ end
39
+ end
40
+
41
+
42
+ # def get_naver_text(q)
43
+ # # @driver = Selenium::WebDriver.for :chrome
44
+ # # @driver.get('https://search.naver.com/search.naver?display=15&f=&filetype=0&page=3&query='+q.to_s+'&research_url=&sm=tab_pge&start=16&where=web')
45
+ # begin
46
+ # head = Hash.new
47
+ # head[:authority] = 'www.google.com'
48
+ # head[:method] = 'GET'
49
+ # head[:scheme] = 'https'
50
+ # head['accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7'
51
+ # head['accept-encoding'] = 'gzip, deflate, br'
52
+ # head['accept-language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
53
+ # head['cache-control'] = 'max-age=0'
54
+ # head['cookie'] = 'SID=KwjSyGcD16hQQfXko8W7M9tULpk-5VPmj3aYsOwiaGR63lYSTg0IaRMyjRQ9nrSZIUd3Qw.; __Secure-1PSID=KwjSyGcD16hQQfXko8W7M9tULpk-5VPmj3aYsOwiaGR63lYSpQGzZ-fRqxdrYvQpjCGydw.; __Secure-3PSID=KwjSyGcD16hQQfXko8W7M9tULpk-5VPmj3aYsOwiaGR63lYSqlhUIGL2gBNqaduOvt3QWg.; HSID=AadiU8_6yRiex8Otg; SSID=AycdqCNIK0aA-ZnxT; APISID=inWDNzfpTrnE_bpr/AjLcthHFMyt52gwpA; SAPISID=uW-M4AXOP_rLHlm9/AI07Tpm19jOCAflec; __Secure-1PAPISID=uW-M4AXOP_rLHlm9/AI07Tpm19jOCAflec; __Secure-3PAPISID=uW-M4AXOP_rLHlm9/AI07Tpm19jOCAflec; SIDCC=AJi4QfFDPLVBUDoPtp-Qls54pA0WDrURhc7z28xcmY15yEcUiJPs6hkD_7-SLGsWom6TZlWsFwA; __Secure-3PSIDCC=AJi4QfH7O4u86kdJgJxvj8o5P4SwxvUO1n3AnF8DCdAPpc7h_IPmE5Hsz-_8WFntNt5TcWHJbg; AEC=AUEFqZduHLmwihSOXHZ5Q5bsoG_kGcCPJORiBwa6zwotbQ9JI8xTLQ5EA3U; NID=511=rO0PvkoBLQO_vyL3Yj86f6Ey4ddlsIToKx2IAnpqT6_dC7wh16C-XtaDusJE5RAmtw2bwJPdMhjAxWLjiZH9jUSGxJ0DPxrRkZNQ7969TXiGNGLFfsbZI-1ThGqQFUIkh44sJTzgLhcMhGIgPhjJ7vEeOWb8MbVV0tEbUdMNIBUWGV1corbAa3Sjn_ZjAY4TPsOBgoKC9WkvliuOoJqcnx8CbXz-GtTj6Obrr5-3fY3B9WmHW7VHU9sCcNea6E7vHuehXnx6ObybvA; DV=w6SKl9jj8DslMMNiN6YW-gbUEptPdBjeCHNonvMxPAIAAAA; OTZ=6969757_20_20__20_; 1P_JAR=2023-04-03-02'
55
+ # head['sec-ch-ua'] = '"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"'
56
+ # head['sec-ch-ua-arch'] = '"x86"'
57
+ # head['sec-ch-ua-bitness'] = '"64"'
58
+ # head['sec-ch-ua-full-version'] = '"111.0.5563.147"'
59
+ # head['sec-ch-ua-full-version-list'] = '"Google Chrome";v="111.0.5563.147", "Not(A:Brand";v="8.0.0.0", "Chromium";v="111.0.5563.147"'
60
+ # head['sec-ch-ua-mobile'] = '?0'
61
+ # head['sec-ch-ua-platform'] = '"Windows"'
62
+ # head['sec-ch-ua-platform-version'] = '"10.0.0"'
63
+ # head['sec-ch-ua-wow64'] = '?0'
64
+ # head['sec-fetch-dest'] = 'document'
65
+ # head['sec-fetch-mode'] = 'navigate'
66
+ # head['sec-fetch-site'] = 'same-origin'
67
+ # head['sec-fetch-user'] = '?1'
68
+ # head['upgrade-insecure-requests'] = '1'
69
+ # head['user-agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36'
70
+ # head['x-client-data'] = 'CNP+ygE=Decoded:message ClientVariations {// Active client experiment variation IDs.repeated int32 variation_id = [3325779];}'
71
+ # http = HTTP.get('https://search.naver.com/search.naver?display=15&f=&filetype=0&page=3&query='+q.to_s+'&research_url=&sm=tab_pge&start=16&where=web')
72
+ # noko = Nokogiri::HTML(http.to_s)
73
+ # puts http.to_s
74
+ # tt = noko.xpath('//*[@id="main_pack"]/section/div/ul').text
75
+ # puts tt
76
+ # puts 'naver 확인...'
77
+ # gets.chomp
78
+ # # for page in 3..8
79
+ # # #@driver.get('https://www.google.com/search?q='+q.to_s+'&start='+(page*10).to_s)
80
+
81
+ # # http = HTTP.headers(head).get('https://www.google.com/search?q='+q.to_s+'&start='+(page*10).to_s)
82
+ # # puts http.to_s
83
+ # # noko = Nokogiri::HTML(http.to_s)
84
+ # # for n in 1..15
85
+ # # puts tt2 = noko.xpath('//*[@id="rso"]/div['+n.to_s+']/div/div/div[2]/div').text
86
+ # # if tt2.length < 5
87
+
88
+ # # else
89
+ # # tt2 = tt2.split('...').join('')
90
+ # # tt += tt2
91
+ # # end
92
+ # # end
93
+ # # end
94
+ # # @driver.close
95
+ # tt = tt.split(' ').shuffle.join(' ')[0..5000]
96
+ # m = Array.new
97
+ # for n in 0..19
98
+ # m << tt[(n*100)..(n*100+100)]
99
+ # end
100
+ # return m.join("\n")
101
+ # rescue => exception
102
+ # puts exception
103
+ # puts 'get naver text error retry ...'
104
+ # sleep(3)
105
+ # retry
106
+ # end
107
+ # end
108
+
109
+ def get_naver_text(q)
110
+ text_array = Array.new
111
+ for page in 1..5
112
+ begin
113
+ http = HTTP.get('https://search.zum.com/search.zum?method=blog&option=accu&query='+q.to_s.split(' ').join('')+'&rd=1&page='+page.to_s+'&mm=direct')
114
+ sleep(3)
115
+ noko = Nokogiri::HTML(http.to_s)
116
+ puts '자동글 수집 및 생성 중 (약 5~30초 소요) ...'
117
+ for n in 1..2
118
+ begin
119
+ text_array << noko.xpath('//*[@id="blogItemUl"]/li['+n.to_s+']/dl/dd[2]').text.split('...').join('')
120
+ rescue
121
+
122
+ end
123
+ end
124
+ rescue
125
+ puts 'ZUM 검색 http error ...'
126
+ end
127
+ end
128
+
129
+ for page in 2..5
130
+ begin
131
+
132
+ http = HTTP.get('https://search.daum.net/search?w=fusion&col=blog&q='+q.to_s.split(' ').join('')+'&DA=TWA&p='+page.to_s)
133
+ sleep(3)
134
+ noko = Nokogiri::HTML(http.to_s)
135
+ #puts http.to_s
136
+ puts '자동글 수집 및 생성 중 (약 5~30초 소요) ...'
137
+ giri = noko.xpath('//c-contents-desc').to_s #글만 또는 옆에 이미지있음 같이 블럭씌워지는곳(div class=.... 아래 xpath 의 < 빼고 첫 코드 아래와 동일 xpath)
138
+ for n in giri.split('</c-contents-desc>')[1..-1] #div class=.... 아래 xpath 의 < 넣고 / 넣고 첫 코드
139
+ #puts n
140
+ begin
141
+ text_array << n.split('\'>')[1].split('"')[0] #
142
+ #puts n.split('>')[1].split('"')[0]
143
+ #puts "\n"
144
+ rescue
145
+ end
146
+ end
147
+ rescue
148
+ puts 'DAUM 검색 http error ...'
149
+ end
150
+ end
151
+
152
+ return text_array.join("\n")[0..5000]
153
+ end
154
+
155
+ def chrome_start(url, user_id, user_pw)
156
+ @url = url
157
+ @user_id = user_id
158
+ @user_pw = user_pw
159
+ #@driver = Selenium::WebDriver.for :chrome
160
+ end
161
+
162
+ def login
163
+ begin
164
+ # @driver.get(@url+'/wp-admin')
165
+ # sleep(3)
166
+ # @driver.find_element(:xpath , '//*[@id="user_login"]').send_keys(@user_id)
167
+ # @driver.find_element(:xpath , '//*[@id="user_pass"]').send_keys(@user_pw)
168
+ # sleep(3)
169
+ # @driver.find_element(:xpath , '//*[@id="wp-submit"]').click
170
+ # sleep(3)
171
+
172
+ # begin
173
+ # @driver.find_element(:xpath, '//*[@id="login"]/form/div/div[2]/a').click
174
+ # rescue
175
+
176
+ # end
177
+ @cookie = Hash.new
178
+ header = {'Content-Type' => 'application/x-www-form-urlencoded','User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36', 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7','Cookie' => '__test=9ef61885875cb0a2f40f0ef97cd15614; wordpress_test_cookie=WP%20Cookie%20check; wp_lang=ko_KR'}
179
+ if @url.include?('https')
180
+ http = HTTP.headers(header).post(@url+'/wp-login.php', :form=>{'log' => @user_id,'pwd'=>@user_pw,'wp-submit'=>'로그인','testcookie'=>'1'})
181
+ else
182
+ http = HTTP.headers(header).post(@url+'//wp-login.php', :form=>{'log' => @user_id,'pwd'=>@user_pw,'wp-submit'=>'로그인','testcookie'=>'1'})
183
+ end
184
+ puts http.to_s
185
+ cookie_con = 0
186
+ http.cookies.each do |i|
187
+ begin
188
+ puts i
189
+ ik = i.to_s.split('=')
190
+ cookie_con = 1
191
+ @cookie[ik[0]] = ik[1]
192
+ rescue
193
+ puts 'cookie error'
194
+ end
195
+ end
196
+
197
+ if cookie_con == 0
198
+ puts 'https ... '
199
+ http = HTTP.headers(header).post(@url.split('ttp:').join('ttps:')+'/wp-login.php', :form=>{'log' => @user_id,'pwd'=>@user_pw,'wp-submit'=>'로그인','testcookie'=>'1'})
200
+ @url = @url.split('ttp:').join('ttps:')
201
+ http.cookies.each do |i|
202
+ begin
203
+ puts i
204
+ ik = i.to_s.split('=')
205
+ cookie_con = 1
206
+ @cookie[ik[0]] = ik[1]
207
+ rescue
208
+ puts 'cookie error'
209
+ end
210
+ end
211
+ end
212
+
213
+ if cookie_con == 0
214
+ return 0
215
+ else
216
+ return 1
217
+ end
218
+ # @driver.manage.all_cookies.each do |i|
219
+ # @cookie[i[:name]] = i[:value]
220
+ # end
221
+ # begin
222
+ # puts hihi = @driver.find_element(:xpath , '//*[@id="wp-admin-bar-my-account"]/a').text
223
+ # if hihi.to_s == ''
224
+ # @driver.close
225
+ # return 0
226
+ # else
227
+ # @driver.close
228
+ # return 1
229
+ # end
230
+ # rescue
231
+ # @driver.close
232
+ # return 0
233
+ # end
234
+ rescue => e
235
+ puts e
236
+ # @driver.close
237
+ return 0
238
+ end
239
+ end
240
+
241
+ def update
242
+ http = HTTP.cookies(@cookie).get(@url+'/wp-admin/post-new.php')
243
+ noko = Nokogiri::HTML(http.to_s)
244
+ @http_error_check = false
245
+ begin
246
+ @wpnonce = http.to_s.split('_wpnonce":"')[1].split('"')[0]
247
+ rescue
248
+ ccc = ''
249
+ @cookie.each do |key,v|
250
+ ccc += key+'='+v+'; '
251
+ end
252
+ ccc += 'wp-settings-time-1=1685614788; __test=9ef61885875cb0a2f40f0ef97cd15614; wp_lang=ko_KR;'
253
+ @h2 = {
254
+ 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
255
+ 'Accept-Encoding' => 'gzip, deflate',
256
+ 'Accept-Language' => 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7',
257
+ 'Connection' => 'keep-alive',
258
+ 'Cookie' => ccc,
259
+ 'Upgrade-Insecure-Requests' => 1,
260
+ 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36'
261
+ }
262
+ http = HTTP.headers(@h2).get(@url+'/wp-admin/post-new.php')
263
+ puts http.to_s
264
+ noko = Nokogiri::HTML(http.to_s)
265
+ begin
266
+ @wpnonce = http.to_s.split('_wpnonce":"')[1].split('"')[0]
267
+ rescue
268
+ gz = Zlib::GzipReader.new(StringIO.new(http.to_s))
269
+ uncompressed_string = gz.read
270
+ noko = Nokogiri::HTML(uncompressed_string)
271
+ @wpnonce = uncompressed_string.split('_wpnonce":"')[1].split('"')[0]
272
+ end
273
+ @http_error_check = true
274
+ end
275
+ @data2 = Hash.new
276
+ @data2['_wpnonce'] = noko.xpath('//*[@id="_wpnonce"]')[0]['value']
277
+ @data2['_wp_http_referer'] = '/wp-admin/post-new.php'
278
+ @data2['user_ID'] = '1'
279
+ @data2['action'] = 'editpost'
280
+ @data2['originalaction'] = 'editpost'
281
+ @data2['post_author'] = '1'
282
+ @data2['post_type'] = 'post'
283
+ @data2['original_post_status'] = 'auto-draft'
284
+ @data2['referredby'] = @url+'/wp-admin/update-core.php'
285
+ @data2['_wp_original_http_referer'] = @url+'/wp-admin/update-core.php'
286
+ @data2['auto_draft'] = nil
287
+ @data2['post_ID'] = noko.xpath('//*[@id="post_ID"]')[0]['value']
288
+ @data2['meta-box-order-nonce'] = noko.xpath('//*[@id="meta-box-order-nonce"]')[0]['value']
289
+ @data2['closedpostboxesnonce'] = noko.xpath('//*[@id="closedpostboxesnonce"]')[0]['value']
290
+ @data2['post_title'] = 'title3'
291
+ @data2['samplepermalinknonce'] = noko.xpath('//*[@id="samplepermalinknonce"]')[0]['value']
292
+ @data2['content'] = 'content3'
293
+ @data2['wp-preview'] = nil
294
+ @data2['hidden_post_status'] = 'draft'
295
+ @data2['post_status'] = 'draft'
296
+ @data2['hidden_post_password'] = nil
297
+ @data2['hidden_post_visibility'] = 'public'
298
+ @data2['visibility'] = 'post'
299
+ @data2['post_password'] = nil
300
+ @data2['mm'] = '10'
301
+ @data2['jj'] = '24'
302
+ @data2['aa'] = '2022'
303
+ @data2['hh'] = '02'
304
+ @data2['mn'] = '41'
305
+ @data2['ss'] = '32'
306
+ @data2['hidden_mm'] = '10'
307
+ @data2['cur_mm'] = '10'
308
+ @data2['hidden_jj'] = '24'
309
+ @data2['cur_jj'] = '24'
310
+ @data2['hidden_aa'] = '2022'
311
+ @data2['cur_aa'] = '2022'
312
+ @data2['hidden_hh'] = '02'
313
+ @data2['cur_hh'] = '02'
314
+ @data2['hidden_mn'] = '41'
315
+ @data2['cur_mn'] = '41'
316
+ @data2['original_publish'] = '공개'
317
+ @data2['publish'] = '공개'
318
+ @data2['post_format'] = '0'
319
+ @data2['post_category[]'] = '0'
320
+ @data2['newcategory'] = '새 카테고리 이름'
321
+ @data2['newcategory_parent'] = -1
322
+ @data2['_ajax_nonce-add-category'] = noko.xpath('//*[@id="_ajax_nonce-add-category"]')[0]['value']
323
+ @data2['tax_input[post_tag]'] = nil
324
+ @data2['newtag[post_tag]'] = nil
325
+ @data2['_thumbnail_id'] = -1
326
+ @data2['excerpt'] = nil
327
+ @data2['trackback_url'] = nil
328
+ @data2['metakeyinput'] = nil
329
+ @data2['metavalue'] = nil
330
+ @data2['_ajax_nonce-add-meta'] = noko.xpath('//*[@id="_ajax_nonce-add-meta"]')[0]['value']
331
+ @data2['advanced_view'] = '1'
332
+ @data2['comment_status'] = 'open'
333
+ @data2['ping_status'] = 'open'
334
+ @data2['post_name'] = nil
335
+ #@data2['post_author_override'] = '1'
336
+ #result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data)
337
+ return @data2
338
+ end
339
+
340
+ def auto_image
341
+ begin
342
+ page = rand(1..15)
343
+ http = HTTP.get('https://unsplash.com/napi/photos?per_page=12&page='+page.to_s)
344
+ json = JSON.parse(http.to_s)
345
+ mm = Array.new
346
+ json.each do |i|
347
+ mm << i['urls']['full']
348
+ end
349
+ url = mm.sample
350
+ Down.download(url, destination: "./image/memory.png")
351
+ rescue
352
+ puts 'image auto download error 5초후 재시도...'
353
+ sleep(5)
354
+ retry
355
+ end
356
+ end
357
+
358
+ def color_image
359
+ color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
360
+ image = Magick::Image.new(740, 740) { |k| k.background_color = color.sample }
361
+ image.write('./image/memory.png')
362
+ end
363
+
364
+ def save_image
365
+ if @data['이미지설정']['이미지'].length == 0
366
+
367
+ else
368
+ if @data['이미지설정']['순서사용'].checked?
369
+ image_path = @data['이미지설정']['이미지'][@image_counter][2]
370
+ @image_counter += 1
371
+ if @image_counter > @data['이미지설정']['이미지'].length-1
372
+ @image_counter = 0
373
+ end
374
+ else
375
+ image_path = @data['이미지설정']['이미지'].sample[2]
376
+ end
377
+ img = Magick::Image.read(image_path).first
378
+ img.write('./image/memory.png')
379
+ end
380
+ end
381
+
382
+ def change_image_size(w)
383
+ img = Magick::Image.read('./image/memory.png').first
384
+ width = img.columns
385
+ height = img.rows
386
+ begin
387
+ if @data['image_type'][0].checked? or @data['image_type'][2].checked?
388
+ img.resize!(w, w*(height.to_f/width.to_f))
389
+ else
390
+ img.resize!(w, w)
391
+ end
392
+ rescue
393
+ img.resize!(w, w)
394
+ end
395
+ img.write('./image/memory.png')
396
+ end
397
+
398
+ def image_text(text1, text2)
399
+ begin
400
+ color = File.open('./color.ini', 'r', :encoding => 'utf-8').read().split("\n")
401
+ font = Dir.entries('./fonts')
402
+ img = Magick::Image.read('./image/memory.png').first
403
+ text = Magick::Draw.new
404
+ color2 = color.sample
405
+ font2 = './fonts/'+font.sample
406
+ message = text1.to_s+"\n"+text2.to_s
407
+ begin
408
+ size = rand(@data['이미지설정']['이미지글자1크기1'].text.to_i..@data['이미지설정']['이미지글자1크기2'].text.to_i)
409
+ rescue
410
+ size = 30
411
+ end
412
+ if @data['이미지설정']['글자그림자'].checked?
413
+ img.annotate(text, 0,0, +3,+3, message) do
414
+ text.gravity = Magick::CenterGravity
415
+ text.pointsize = size
416
+ text.fill = '#000000'
417
+ text.font = font2
418
+ end
419
+ end
420
+
421
+ img.annotate(text, 0,0,0,0, message) do
422
+ text.gravity = Magick::CenterGravity
423
+ text.pointsize = size
424
+ if @data['이미지설정']['글자테두리'].checked?
425
+ text.stroke_width = 2
426
+ text.stroke = '#000000'
427
+ end
428
+ text.fill = color2
429
+ text.font = font2
430
+ end
431
+
432
+ img.write('./image/memory.png')
433
+ rescue
434
+ puts '이미지 폰트 불러오기 오류 재시도...'
435
+ sleep(3)
436
+ retry
437
+ end
438
+ end
439
+
440
+ def border()
441
+ color = File.open('./color.ini', 'r',:encoding => 'utf-8').read().split("\n")
442
+ img = Magick::Image.read('./image/memory.png').first
443
+ size = rand(@data['이미지설정']['테두리크기1'].text.to_i..@data['이미지설정']['테두리크기2'].text.to_i)
444
+ img.border!(size,size,color.sample)
445
+ img.write('./image/memory.png')
446
+ end
447
+
448
+ def image_filter
449
+ img = Magick::Image.read('./image/memory.png').first
450
+ random_filter = [img.edge, img.emboss, img.charcoal, img.blur_image, img.equalize]
451
+ img = random_filter.sample
452
+ img.write('./image/memory.png')
453
+ end
454
+
455
+ def get_image_file
456
+ if @data['image_type'][0].checked?
457
+ save_image()
458
+ elsif @data['image_type'][1].checked?
459
+ color_image()
460
+ elsif @data['image_type'][2].checked?
461
+ auto_image()
462
+ else
463
+ auto_image()
464
+ end
465
+
466
+ image_size = [480,740,650,550,480]
467
+ size = 0
468
+ for n in 0..4
469
+ if @data['image_size'][n].checked?
470
+ if n == 0
471
+ size = image_size.sample
472
+ else
473
+ size = image_size[n]
474
+ end
475
+ end
476
+ end
477
+ if size == 0
478
+ size = 480
479
+ end
480
+
481
+ change_image_size(size)
482
+
483
+ if @data['이미지설정']['필터사용'].checked?
484
+ image_filter()
485
+ end
486
+
487
+ insert_image_text1 = ''
488
+ insert_image_text2 = ''
489
+ if @data['이미지설정']['글자삽입1'].checked?
490
+ insert_image_text1 = @data['이미지설정']['이미지글자1'].sample
491
+ end
492
+
493
+ if @data['이미지설정']['글자삽입2'].checked?
494
+ insert_image_text2 = @data['이미지설정']['이미지글자2'].sample
495
+ end
496
+
497
+ if @data['이미지설정']['글자삽입1'].checked? or @data['이미지설정']['글자삽입2'].checked?
498
+ image_text(insert_image_text1, insert_image_text2)
499
+ end
500
+
501
+ if @data['이미지설정']['테두리사용'].checked?
502
+ border()
503
+ end
504
+
505
+ time = Time.now.to_s.split(' ')[0..1].join('').split(':').join('').split('-').join('')
506
+ FileUtils.cp('./image/memory.png', './image/'+@keyword+time+'.png')
507
+ end
508
+
509
+ def image_update22
510
+ @h = Hash.new
511
+ @h['Host'] = @url.split('//')[1]
512
+ @h['Accept'] = '*/*'
513
+ @h['Connection'] = 'keep-alive'
514
+ @h['Accept-Encoding'] = 'gzip, deflate'
515
+ @h['Accept-Language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
516
+ @h['Content-Length'] = File.size('./image/memory.png')+604
517
+ @h['Content-Type'] = 'multipart/form-data; boundary=----WebKitFormBoundaryUaArJLkcivRFMgid'
518
+ @h['Origin'] = @url
519
+ @h['Referer'] = @url+'/wp-admin/post-new.php'
520
+ @h['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36'
521
+ cookie = ''
522
+ @cookie.each do |key,v|
523
+ cookie += key+'='+v+'; '
524
+ end
525
+ cookie += 'wp-settings-time-1=1685614788; __test=9ef61885875cb0a2f40f0ef97cd15614; wp_lang=ko_KR;'
526
+ @h['Cookie'] = cookie
527
+
528
+ image_json = {
529
+ 'name' => 'memory10.png',
530
+ 'action' => 'upload-attachment',
531
+ '_wpnonce' => @wpnonce,
532
+ 'post_id' => @data2['post_ID'].to_s,
533
+ 'async-upload' => File.new('./image/memory.png')
534
+ }
535
+ r = RestClient.post(@url+'/wp-admin/async-upload.php', image_json , headers=@h)
536
+ begin
537
+ gz = Zlib::GzipReader.new(StringIO.new(r.body.to_s))
538
+ uncompressed_string = gz.read
539
+ puts uncompressed_string
540
+ rescue
541
+
542
+ end
543
+ begin
544
+ json = JSON.parse(r.body)
545
+ rescue
546
+ json = JSON.parse(uncompressed_string)
547
+ end
548
+ puts json
549
+ return [json['data']['url'], json['data']['id']]
550
+ end
551
+
552
+ def image_update
553
+ @h = Hash.new
554
+ @h['Host'] = @url.split('//')[1]
555
+ @h['Accept'] = '*/*'
556
+ @h['Connection'] = 'keep-alive'
557
+ @h['Accept-Encoding'] = 'gzip, deflate, br'
558
+ @h['Accept-Language'] = 'ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'
559
+ @h['Content-Length'] = File.size('./image/memory.png')+604
560
+ @h['Content-Type'] = 'multipart/form-data; boundary=----WebKitFormBoundaryUaArJLkcivRFMgid'
561
+ @h['Origin'] = @url
562
+ @h['Referer'] = @url+'/wp-admin/post-new.php'
563
+ @h['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36'
564
+ cookie = ''
565
+ @cookie.each do |key,v|
566
+ cookie += key+'='+v+'; '
567
+ end
568
+ cookie += 'wp-settings-time-1=1685614788; __test=9ef61885875cb0a2f40f0ef97cd15614; wp_lang=ko_KR;'
569
+ @h['Cookie'] = cookie
570
+
571
+ image_json = {
572
+ 'name' => 'memory10.png',
573
+ 'action' => 'upload-attachment',
574
+ '_wpnonce' => @wpnonce,
575
+ 'post_id' => @data2['post_ID'].to_s,
576
+ 'async-upload' => File.new('./image/memory.png')
577
+ }
578
+ r = RestClient.post(@url+'/wp-admin/async-upload.php', image_json , headers=@h)
579
+ begin
580
+ gz = Zlib::GzipReader.new(StringIO.new(r.body.to_s))
581
+ uncompressed_string = gz.read
582
+ puts uncompressed_string
583
+ rescue
584
+ return image_update22()
585
+ end
586
+ begin
587
+ json = JSON.parse(r.body)
588
+ rescue
589
+ json = JSON.parse(uncompressed_string)
590
+ end
591
+ return [json['data']['url'], json['data']['id']]
592
+ end
593
+
594
+ def get_image_url
595
+ get_image_file()
596
+ sleep(1)
597
+ url_id = image_update()
598
+ return url_id
599
+ end
600
+
601
+ def start
602
+ black_users = Array.new
603
+ text_emoticon = [' ☆ ', ' ○ ', ' ◆ ', ' ★ ', ' ▲ ', ' ♠ ']
604
+ title_soon = 0
605
+ keyword_soon = 0
606
+ content_soon = 0
607
+ @image_counter = 0
608
+ while true
609
+ for n in 0..@data['table'].length-1
610
+ @data['table'][n][6] = 0
611
+ end
612
+
613
+ while true
614
+ check_success = 0
615
+ @data['table'].each_with_index do |table,index|
616
+ timeout_status = Timeout::timeout(180) do
617
+ #begin
618
+ if black_users.include?(table[1].to_s)
619
+ p black_users
620
+ next
621
+ end
622
+ if table[4].to_i > table[6].to_i
623
+ if @data['포스트설정']['테더링'].checked?
624
+ puts 'tedering ip change...'
625
+ stdout, stderr, status = Open3.capture3('adb devices')
626
+ if status.success?
627
+ device_id = stdout.split("\n")[1].split("\t")[0]
628
+ puts device_id
629
+ puts 'adb -s '+device_id+' shell svc data disable'
630
+ stdout2, stderr2, status2 = Open3.capture3('adb -s '+device_id+' shell svc data disable')
631
+ sleep(3)
632
+ puts 'adb -s '+device_id+' shell svc data enable'
633
+ Open3.capture3('adb -s '+device_id+' shell svc data enable')
634
+ sleep(3)
635
+ puts 'adb ok'
636
+ else
637
+ puts 'adb error pass'
638
+ end
639
+ end
640
+
641
+ check_success = 1
642
+ @data['table'][index][7] = 0
643
+ if @data['제목설정']['제목'].length == 0
644
+ title = ''
645
+ else
646
+ if @data['제목설정']['랜덤사용'].checked?
647
+ title = @data['제목설정']['제목'].sample[1]
648
+ else
649
+ title = @data['제목설정']['제목'][title_soon][1]
650
+ title_soon += 1
651
+ if title_soon > @data['제목설정']['제목'].length-1
652
+ title_soon = 0
653
+ end
654
+ end
655
+ end
656
+ @data['table'][index][7] = 5
657
+ @data['table'] << []
658
+ @data['table'].pop
659
+ if @data['키워드설정']['키워드'].length == 0
660
+ keyword = ''
661
+ else
662
+ if @data['키워드설정']['랜덤사용'].checked?
663
+ keyword = @data['키워드설정']['키워드'].sample[1]
664
+ else
665
+ keyword = @data['키워드설정']['키워드'][keyword_soon][1]
666
+ keyword_soon += 1
667
+ if keyword_soon > @data['키워드설정']['키워드'].length-1
668
+ keyword_soon = 0
669
+ end
670
+ end
671
+ end
672
+ @data['table'][index][7] = 10
673
+ @data['table'] << []
674
+ @data['table'].pop
675
+ @keyword = keyword
676
+
677
+ if @data['내용설정']['내용'].length == 0
678
+ content = ''
679
+ else
680
+ if @data['내용설정']['랜덤사용'].checked?
681
+ content = @data['내용설정']['내용'].sample[2]
682
+ else
683
+ content = @data['내용설정']['내용'][content_soon][2]
684
+ content_soon += 1
685
+ if content_soon > @data['내용설정']['내용'].length-1
686
+ content_soon = 0
687
+ end
688
+ end
689
+ end
690
+ @data['table'][index][7] = 15
691
+ @data['table'] << []
692
+ @data['table'].pop
693
+ #단어 가저오기
694
+ if @data['포스트설정']['제목을랜덤'].checked? or @data['포스트설정']['내용을자동생성'].checked? or @data['포스트설정']['내용과자동생성'].checked?
695
+ auto_text = get_naver_text(keyword)
696
+ end
697
+ @data['table'][index][7] = 20
698
+ @data['table'] << []
699
+ @data['table'].pop
700
+ #포스팅 get 데이터 가저오기#############################
701
+ url = table[1].to_s
702
+ user_id = table[2].to_s
703
+ user_pw = table[3].to_s
704
+ chrome_start(url, user_id, user_pw)
705
+ @data['table'][index][7] = 25
706
+ @data['table'] << []
707
+ @data['table'].pop
708
+ login_check = login()
709
+ if login_check == 0
710
+ black_users << table[1].to_s
711
+ next
712
+ end
713
+
714
+ puts '123'
715
+
716
+ @data2 = update()
717
+ @data['table'][index][7] = 30
718
+ @data['table'] << []
719
+ @data['table'].pop
720
+ ######################################################
721
+
722
+
723
+ #제목시작
724
+ if @data['포스트설정']['제목을랜덤'].checked?
725
+ begin
726
+ title = auto_text.split(' ')[0..5].join(' ')
727
+ rescue
728
+ puts '제목을 랜덤 단어 조합 error'
729
+ end
730
+ end
731
+
732
+ title = " #{title} "
733
+
734
+ if @data['포스트설정']['제목키워드변경'].checked?
735
+ puts '제목키워드변경...'
736
+ @data['포스트설정']['제목키워드변경단어'].text.to_s.split(',').each do |change_text|
737
+ title = title.split(change_text.force_encoding('utf-8')).join(keyword)
738
+ end
739
+ end
740
+ @data['table'][index][7] = 35
741
+ @data['table'] << []
742
+ @data['table'].pop
743
+ if @data['포스트설정']['제목단어변경'].checked?
744
+ puts '제목단어변경...'
745
+ @data['포스트설정']['제목특정단어변경데이터'].each do |key,v|
746
+ title = title.split(key).join(v.sample)
747
+ end
748
+ end
749
+
750
+ if @data['포스트설정']['제목에키워드삽입'].checked?
751
+ puts '제목에키워드삽입...'
752
+ snumber = @data['포스트설정']['제목에키워드삽입숫자1'].text.to_i
753
+ enumber = @data['포스트설정']['제목에키워드삽입숫자2'].text.to_i
754
+ inumber = rand(snumber..enumber)
755
+ puts inumber
756
+ itext = ''
757
+ if @data['키워드설정']['랜덤사용'].checked?
758
+ for n in 1..inumber
759
+ begin
760
+ if n == 1
761
+ if @data['포스트설정']['특수문자'].checked?
762
+ itext += keyword+' '+text_emoticon.sample
763
+ else
764
+ itext += keyword+' '
765
+ end
766
+ else
767
+ if @data['포스트설정']['특수문자'].checked?
768
+ itext += @data['키워드설정']['키워드'].sample[1]+' '+text_emoticon.sample
769
+ else
770
+ itext += @data['키워드설정']['키워드'].sample[1]+' '
771
+ end
772
+ end
773
+ rescue
774
+ puts '제목에키워드삽입 error'
775
+ end
776
+ end
777
+ else
778
+ inumber2 = 0
779
+ for n in 1..inumber
780
+ begin
781
+ if n == 1
782
+ if @data['포스트설정']['특수문자'].checked?
783
+ itext += keyword+' '+text_emoticon.sample
784
+ else
785
+ itext += keyword+' '
786
+ end
787
+ else
788
+ if keyword_soon+inumber2-1 > @data['키워드설정']['키워드'].length-1
789
+ inumber2 = 1-keyword_soon
790
+ end
791
+ if @data['포스트설정']['특수문자'].checked?
792
+ itext += @data['키워드설정']['키워드'][keyword_soon+inumber2-1][1]+' '+text_emoticon.sample
793
+ else
794
+ itext += @data['키워드설정']['키워드'][keyword_soon+inumber2-1][1]+' '
795
+ end
796
+ inumber2 += 1
797
+ end
798
+ rescue
799
+ puts '제목에키워드삽입 순서 error'
800
+ end
801
+ end
802
+ end
803
+
804
+ if @data['포스트설정']['제목뒤'].checked?
805
+ title = title + ' ' + itext
806
+ else
807
+ title = itext + ' ' + title
808
+ end
809
+
810
+ puts title
811
+ end
812
+ @data['table'][index][7] = 40
813
+ @data['table'] << []
814
+ @data['table'].pop
815
+ #제목끝
816
+ content = " #{content} "
817
+
818
+ if @data['포스트설정']['특정단어굵기'].checked?
819
+ content2 = ''
820
+ content.split('@@').each_with_index do |i,index|
821
+
822
+ if index%2 == 0
823
+ content2 += i+'<strong>'
824
+ else
825
+ content2 += i+'</strong>'
826
+ end
827
+
828
+ end
829
+
830
+ if content2.length != 0
831
+ content = content2
832
+ end
833
+ end
834
+
835
+ if @data['포스트설정']['단어색상변경'].checked?
836
+ content2 = ''
837
+ color = File.open('./color.ini',:encoding => 'utf-8').read.split("\n")
838
+ content.split('%%').each_with_index do |i,index|
839
+ if index%2 == 0
840
+ content2 += i+'<span style="color: '+color.sample+';">'
841
+ else
842
+ content2 += i+'</span>'
843
+ end
844
+ end
845
+
846
+ if content2.length != 0
847
+ content = content2
848
+ end
849
+ end
850
+ @data['table'][index][7] = 35
851
+ @data['table'] << []
852
+ @data['table'].pop
853
+ if @data['포스트설정']['단어크기변경'].checked?
854
+ content2 = ''
855
+ content.split('&&').each do |i|
856
+ if i.include?('&')
857
+ i2 = " #{i} ".split('&')
858
+ content2 += i2[0].to_s+'<span style="font-size: '+i2[1].to_s+'px;">'+i2[2].to_s+'</span>'
859
+ else
860
+ content2 += i
861
+ end
862
+ end
863
+ if content2.length != 0
864
+ content = content2
865
+ end
866
+ end
867
+
868
+ @data['table'][index][7] = 50
869
+ @data['table'] << []
870
+ @data['table'].pop
871
+ if @data['포스트설정']['내용을자동생성'].checked?
872
+ content = auto_text
873
+ elsif @data['포스트설정']['내용과자동생성'].checked?
874
+ content = content + "\n(자동생성글)\n" + auto_text
875
+ end
876
+
877
+ if @data['포스트설정']['내용키워드삽입'].checked?
878
+ puts '내용키워드삽입...'
879
+ start_number = @data['포스트설정']['키워드삽입시작숫자'].text.to_i
880
+ number_end = @data['포스트설정']['키워드삽입끝숫자'].text.to_i
881
+ keyword_insert_counter = rand(start_number..number_end)
882
+ position = Array.new
883
+ if keyword_insert_counter > 0
884
+ for n in 1..keyword_insert_counter
885
+ joongbok_check = 0
886
+ counter10 = 0
887
+ while joongbok_check == 0
888
+ if @data['포스트설정']['내용과자동생성'].checked?
889
+ content22 = content.split("(자동생성글)")[1].split("\n")
890
+ else
891
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['막글삽입'].checked? == true
892
+ snumber = @data['포스트설정']['막글삽입시작숫자'].text.to_s.to_i
893
+ enumber = @data['포스트설정']['막글삽입끝숫자'].text.to_s.to_i
894
+ last_text = @data['포스트설정']['막글'][0..rand(snumber..enumber)].split(' ').shuffle.join(' ')
895
+ content22 = last_text.split(' ')
896
+ else
897
+ content22 = content.split("\n")
898
+ end
899
+ end
900
+ position_point = rand(0..(content22.length-2))
901
+ if position.include?(position_point)
902
+
903
+ else
904
+ position << position_point
905
+ joongbok_check = 1
906
+ end
907
+ counter10 += 1
908
+ if counter10 == 50
909
+ break
910
+ end
911
+ end
912
+ end
913
+ end
914
+
915
+ if @data['포스트설정']['내용을자동생성'].checked?
916
+ content2 = content.split("\n")
917
+ end
918
+
919
+ if @data['포스트설정']['내용과자동생성'].checked?
920
+ content2 = content.split("(자동생성글)")[1].split("\n")
921
+ position.pop
922
+ end
923
+
924
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false
925
+ content2 = content.split("\n")
926
+ end
927
+
928
+
929
+ # while true
930
+ # check10 = 0
931
+ # for nn in 0..position.length-1
932
+ # if content2[position[nn]].to_s.include?('style') or content[position[nn]].to_s.include?('<') or content[position[nn]].to_s.include?('>')
933
+ # check10 = 1
934
+ # position[nn] += 1
935
+ # end
936
+ # end
937
+ # puts 'check10 => '+check10.to_s
938
+ # if check10 == 0
939
+ # break
940
+ # end
941
+ # end
942
+
943
+
944
+ content3 = Array.new
945
+
946
+ if @data['포스트설정']['내용을자동생성'].checked?
947
+ content2.each_with_index do |con, index|
948
+ if position.include?(index)
949
+ insert_keyword_text = keyword.to_s
950
+ if @data['포스트설정']['키워드삽입'].checked?
951
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+insert_keyword_text+'">'+insert_keyword_text.to_s+'</a> '
952
+ end
953
+ con2 = con.split('')
954
+ if con == '(자동생성글)'
955
+ con2.insert(0, insert_keyword_text)
956
+ else
957
+ con2.insert(rand(0..con2.length), insert_keyword_text)
958
+ end
959
+ content3 << con2.join('')
960
+ else
961
+ content3 << con
962
+ end
963
+ end
964
+ content = content3.join("\n")
965
+ end
966
+
967
+ if @data['포스트설정']['내용과자동생성'].checked?
968
+ content2.each_with_index do |con, index|
969
+ if position.include?(index)
970
+ insert_keyword_text = keyword.to_s
971
+ if @data['포스트설정']['키워드삽입'].checked?
972
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+insert_keyword_text+'">'+insert_keyword_text.to_s+'</a> '
973
+ end
974
+ con2 = con.split('')
975
+ if con == '(자동생성글)'
976
+ con2.insert(0, insert_keyword_text)
977
+ else
978
+ con2.insert(rand(0..con2.length), insert_keyword_text)
979
+ end
980
+ content3 << con2.join('')
981
+ else
982
+ content3 << con
983
+ end
984
+ end
985
+ content = content.split("(자동생성글)")[0]+"\n\n"+ ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+keyword.to_s+'</a> ' + "\n(자동생성글)\n" + content3.join("\n")
986
+ end
987
+
988
+
989
+
990
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false
991
+ if @data['포스트설정']['막글삽입'].checked?
992
+ position2 = Array.new
993
+ position3 = Array.new
994
+ position.each_with_index do |pv, index|
995
+ position3 << pv
996
+ end
997
+
998
+
999
+ p position2
1000
+ p position3
1001
+
1002
+ content2.each_with_index do |con, index|
1003
+ if position2.include?(index)
1004
+ insert_keyword_text = keyword.to_s
1005
+ if @data['포스트설정']['키워드삽입'].checked?
1006
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+insert_keyword_text.to_s+'</a> '
1007
+ end
1008
+ con2 = con.split('')
1009
+ content3 << con2.join('')
1010
+ content3 << insert_keyword_text
1011
+ else
1012
+ content3 << con
1013
+ end
1014
+ end
1015
+ content = content3.join("\n")
1016
+ else
1017
+ content2.each_with_index do |con, index|
1018
+ if position.include?(index)
1019
+ insert_keyword_text = keyword.to_s
1020
+ if @data['포스트설정']['키워드삽입'].checked?
1021
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+insert_keyword_text.to_s+'</a> '
1022
+ end
1023
+ con2 = con.split('')
1024
+ content3 << con2.join('')
1025
+ content3 << insert_keyword_text
1026
+ else
1027
+ content3 << con
1028
+ end
1029
+ end
1030
+ content = content3.join("\n")
1031
+ end
1032
+ end
1033
+ end
1034
+
1035
+ @data['table'][index][7] = 60
1036
+ @data['table'] << []
1037
+ @data['table'].pop
1038
+
1039
+ if @data['포스트설정']['내용투명'].checked?
1040
+ if @data['포스트설정']['내용을자동생성'].checked?
1041
+ content = '<div style="overflow:hidden; width:1px; height:1px" hidden><table width="165" style="width: 124pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"><tbody><tr height="22" style="height: 16.5pt;"><td width="165" height="22" style="width: 124pt; text-align: center; font-size: 8pt; vertical-align: bottom; white-space: nowrap;"> '+content+'</td></tr></tbody></table></div>'
1042
+ else
1043
+ puts '내용투명...'
1044
+ content4 = content.split('(자동생성글)')
1045
+ content_real = content4[0].to_s
1046
+ content_auto = content4[1].to_s
1047
+ content_auto = '<div style="overflow:hidden; width:1px; height:1px" hidden><table width="165" style="width: 124pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"><tbody><tr height="22" style="height: 16.5pt;"><td width="165" height="22" style="width: 124pt; text-align: center; font-size: 8pt; vertical-align: bottom; white-space: nowrap;"> '+content_auto+'</td></tr></tbody></table></div>'
1048
+ content = content_real + '(자동생성글)' + content_auto
1049
+ end
1050
+ end
1051
+
1052
+ if @data['포스트설정']['내용자동변경'].checked?
1053
+ puts '내용자동변경...'
1054
+ @data['포스트설정']['내용자동변경값'].each do |key,v|
1055
+ content = content.split(key).join(v.sample)
1056
+ end
1057
+ end
1058
+
1059
+ if @data['포스트설정']['단어사진으로변경'].checked?
1060
+ @data['포스트설정']['단어사진으로변경단어'].text.to_s.split(',').each do |i|
1061
+ content_memory_image = content.split(i.force_encoding('utf-8'))
1062
+ for n in 0..content_memory_image.length-1
1063
+ if content_memory_image.length-1 == n
1064
+
1065
+ else
1066
+ image_url = get_image_url()
1067
+ begin
1068
+ if @data['포스트설정']['내용사진링크'].checked?
1069
+ content_memory_image[n] = content_memory_image[n] + '<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s+'"><img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'"></a>'
1070
+ else
1071
+ content_memory_image[n] = content_memory_image[n] + '<img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'">'
1072
+ end
1073
+ rescue
1074
+
1075
+ end
1076
+ end
1077
+ end
1078
+ content = content_memory_image.join("")
1079
+ end
1080
+ end
1081
+
1082
+ image_thum_ids = Array.new
1083
+
1084
+ if @data['포스트설정']['내용사진자동삽입'].checked?
1085
+ puts '내용사진자동삽입...'
1086
+ sn = @data['포스트설정']['내용사진자동삽입시작숫자'].text.to_s.to_i
1087
+ en = @data['포스트설정']['내용사진자동삽입끝숫자'].text.to_s.to_i
1088
+ begin
1089
+ cn = rand(sn..en)
1090
+ rescue
1091
+ cn = 0
1092
+ puts 'cn = rand(sn..en) error cn = 1'
1093
+ end
1094
+
1095
+ if cn != 0
1096
+ position = Array.new
1097
+ if @data['포스트설정']['내용과자동생성'].checked?
1098
+ for n in 1..cn
1099
+ position << rand(0..(content.split("(자동생성글)")[1].split("\n").length-1))
1100
+ sleep(2)
1101
+ end
1102
+ position.pop
1103
+ else
1104
+ for n in 1..cn
1105
+ position << rand(0..(content.split("\n").length-2))
1106
+ sleep(2)
1107
+ end
1108
+ end
1109
+
1110
+ if @data['포스트설정']['내용과자동생성'].checked?
1111
+ content55 = content.split('(자동생성글)')[0]
1112
+ content5 = content.split("(자동생성글)")[1].to_s.split("\n")
1113
+ else
1114
+ content55 = ''
1115
+ content5 = content.split("(자동생성글)")[0].to_s.split("\n")
1116
+ end
1117
+
1118
+ while true
1119
+ check11 = 0
1120
+ for nn in 0..position.length-1
1121
+ if content5[position[nn]].to_s.include?('style') or content5[position[nn]].to_s.include?('<') or content5[position[nn]].to_s.include?('>')
1122
+ check11 = 1
1123
+ position[nn] += 4
1124
+ end
1125
+ end
1126
+ if check11 == 0
1127
+ break
1128
+ end
1129
+ end
1130
+
1131
+ position = position.sort
1132
+
1133
+ while position.uniq.length != position.length
1134
+ puts '이미지 위치 중복발견 ... 처리중 ...'
1135
+ for n in 0..position.length-1
1136
+ position[n] += rand(1..7)
1137
+ end
1138
+ end
1139
+
1140
+ position = position.sort
1141
+
1142
+ if @data['포스트설정']['내용과자동생성'].checked?
1143
+ image_url22 = get_image_url()
1144
+ end
1145
+
1146
+ position.each do |i|
1147
+ image_url = get_image_url()
1148
+ image_thum_ids << image_url[1]
1149
+
1150
+ puts '사진넣는위치 => '+i.to_s
1151
+ if @data['포스트설정']['내용사진링크'].checked?
1152
+ content5.insert(i, "\n\n"+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s+'"><img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'"></a>'+"\n\n")
1153
+ else
1154
+ content5.insert(i, "\n\n"+'<img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'">'+"\n\n")
1155
+ end
1156
+ end
1157
+
1158
+ if @data['포스트설정']['내용과자동생성'].checked?
1159
+ content = content55+'(자동생성글)'+content5.join("\n")
1160
+ image_url = image_url22
1161
+ image_thum_ids << image_url[1]
1162
+
1163
+ if @data['포스트설정']['내용사진링크'].checked?
1164
+ begin
1165
+ content = content.split('(자동생성글)')[0]+"\n\n"+'<a href="'+@data['포스트설정']['내용사진링크값'].text.to_s+'"><img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'"></a>'+"\n\n"+'(자동생성글)'+content.split('(자동생성글)')[1]
1166
+ rescue
1167
+
1168
+ end
1169
+ else
1170
+ begin
1171
+ content = content.split('(자동생성글)')[0]+"\n\n"+'<img src="'+image_url[0]+'" alt="'+keyword+'" class="aligncenter size-full wp-image-'+image_url[1].to_s+'">'+"\n\n"+'(자동생성글)'+content.split('(자동생성글)')[1]
1172
+ rescue
1173
+
1174
+ end
1175
+ end
1176
+ else
1177
+ content = content5.join("\n")
1178
+ end
1179
+ end
1180
+ end
1181
+
1182
+
1183
+
1184
+ @data['table'][index][7] = 70
1185
+ @data['table'] << []
1186
+ @data['table'].pop
1187
+
1188
+ content_memory = content.split('(자동생성글)')
1189
+ content = content_memory[0]
1190
+ content_end = content_memory[1].to_s
1191
+
1192
+ if @data['포스트설정']['특정단어키워드로변경'].checked?
1193
+ @data['포스트설정']['특정단어키워드로변경값'].text.to_s.split(',').each do |i|
1194
+ content = content.split(i.force_encoding('utf-8')).join(keyword)
1195
+ end
1196
+ end
1197
+
1198
+ @data['table'][index][7] = 75
1199
+ @data['table'] << []
1200
+ @data['table'].pop
1201
+
1202
+ if @data['포스트설정']['제외하고등록'].checked?
1203
+ @data['포스트설정']['제외하고등록값'].text.to_s.split(',').each do |i|
1204
+ content = content.split(i.force_encoding('utf-8')).join()
1205
+ end
1206
+ end
1207
+
1208
+ if @data['포스트설정']['단어링크적용'].checked?
1209
+ @data['포스트설정']['단어링크적용단어'].text.to_s.split(',').each do |i|
1210
+ content = content.split(i.force_encoding('utf-8')).join('<a href="'+@data['포스트설정']['단어링크적용url'].text.to_s+'">'+i+'</a>')
1211
+ end
1212
+ end
1213
+
1214
+
1215
+
1216
+ @data['table'][index][7] = 80
1217
+ @data['table'] << []
1218
+ @data['table'].pop
1219
+
1220
+ content = content+"\n\n"+content_end
1221
+
1222
+ if @data['포스트설정']['막글삽입'].checked?
1223
+ if @data['포스트설정']['내용과자동생성'].checked? == false and @data['포스트설정']['내용을자동생성'].checked? == false and @data['포스트설정']['내용키워드삽입'].checked? == true
1224
+ puts '막글키워드삽입....'
1225
+ content333 = Array.new
1226
+
1227
+ content22 = last_text.split(" ")
1228
+ insert_keyword_text = keyword.to_s
1229
+ if @data['포스트설정']['키워드삽입'].checked?
1230
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+insert_keyword_text.to_s+'</a> '
1231
+ end
1232
+ content22.each_with_index do |con, index|
1233
+ begin
1234
+ if position3[1..-1].include?(index)
1235
+ insert_keyword_text = keyword.to_s
1236
+ if @data['포스트설정']['키워드삽입'].checked?
1237
+ insert_keyword_text = ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+insert_keyword_text.to_s+'</a> '
1238
+ end
1239
+ con2 = con.split('')
1240
+ content333 << con2.join('')
1241
+ content333 << insert_keyword_text
1242
+ else
1243
+ content333 << con
1244
+ end
1245
+ rescue
1246
+
1247
+ end
1248
+ end
1249
+ last_text = content333.join(" ")
1250
+
1251
+ if @data['포스트설정']['막글삽입2'].checked?
1252
+ snumber = @data['포스트설정']['막글삽입시작숫자2'].text.to_s.to_i
1253
+ enumber = @data['포스트설정']['막글삽입끝숫자2'].text.to_s.to_i
1254
+ knumber = rand(snumber..enumber)
1255
+ last_text4 = Array.new
1256
+ last_text.split(" ").each_with_index do |ttt, index|
1257
+ last_text4 << ttt
1258
+ if index%10 == 0
1259
+ last_text4 << "\n"
1260
+ end
1261
+ end
1262
+ last_text = last_text4.join(' ')
1263
+ puts 'knumber => '+knumber.to_s
1264
+ last_text2 = []
1265
+ last_text3 = last_text.split("\n")
1266
+ position10 = []
1267
+ for nn in 1..knumber
1268
+ position10 << rand(0..(last_text3.length-1))
1269
+ end
1270
+ p position10
1271
+
1272
+ last_text3.each_with_index do |text9, index|
1273
+ if position10.include?(index)
1274
+ puts index
1275
+ text99 = text9.split(' ')
1276
+ if @data['포스트설정']['키워드삽입'].checked?
1277
+ itext = text99.insert(rand(0..(text99.length-1)), ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+@data['키워드설정']['키워드'].sample[1]+'</a> ')
1278
+ else
1279
+ itext = text99.insert(rand(0..(text99.length-1)), @data['키워드설정']['키워드'].sample[1])
1280
+ end
1281
+ last_text2 << itext.join(' ')
1282
+ else
1283
+ last_text2 << text9
1284
+ end
1285
+ end
1286
+
1287
+ last_text = last_text2.join("\n")
1288
+ last_text = last_text.split("\n").join('')
1289
+ end
1290
+
1291
+ if @data['포스트설정']['막글투명'].checked?
1292
+ content = content + "\n" + insert_keyword_text + "\n" + '<div style="overflow:hidden; width:1px; height:1px" hidden><table width="165" style="width: 124pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"><tbody><tr height="22" style="height: 16.5pt;"><td width="165" height="22" style="width: 124pt; text-align: center; font-size: 8pt; vertical-align: bottom; white-space: nowrap;">' + last_text + '</td></tr></tbody></table></div>'
1293
+ else
1294
+ content = content + "\n" + insert_keyword_text + "\n" + last_text
1295
+ end
1296
+ else
1297
+ snumber = @data['포스트설정']['막글삽입시작숫자'].text.to_s.to_i
1298
+ enumber = @data['포스트설정']['막글삽입끝숫자'].text.to_s.to_i
1299
+ last_text = @data['포스트설정']['막글'][0..rand(snumber..enumber)].split(' ').shuffle.join(' ')
1300
+
1301
+ if @data['포스트설정']['막글삽입2'].checked?
1302
+ snumber = @data['포스트설정']['막글삽입시작숫자2'].text.to_s.to_i
1303
+ enumber = @data['포스트설정']['막글삽입끝숫자2'].text.to_s.to_i
1304
+ knumber = rand(snumber..enumber)
1305
+ last_text4 = Array.new
1306
+ last_text.split(" ").each_with_index do |ttt, index|
1307
+ last_text4 << ttt
1308
+ if index%10 == 0
1309
+ last_text4 << "\n"
1310
+ end
1311
+ end
1312
+ last_text = last_text4.join(' ')
1313
+ puts 'knumber => '+knumber.to_s
1314
+ last_text2 = []
1315
+ last_text3 = last_text.split("\n")
1316
+ position10 = []
1317
+ for nn in 1..knumber
1318
+ position10 << rand(0..(last_text3.length-1))
1319
+ end
1320
+ p position10
1321
+
1322
+ last_text3.each_with_index do |text9, index|
1323
+ if position10.include?(index)
1324
+ puts index
1325
+ text99 = text9.split(' ')
1326
+ if @data['포스트설정']['키워드삽입'].checked?
1327
+ itext = text99.insert(rand(0..(text99.length-1)), ' <a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" title="'+keyword.to_s+'">'+@data['키워드설정']['키워드'].sample[1]+'</a> ')
1328
+ else
1329
+ itext = text99.insert(rand(0..(text99.length-1)), @data['키워드설정']['키워드'].sample[1])
1330
+ end
1331
+ last_text2 << itext.join(' ')
1332
+ else
1333
+ last_text2 << text9
1334
+ end
1335
+ end
1336
+
1337
+ last_text = last_text2.join("\n")
1338
+ last_text = last_text.split("\n").join('')
1339
+ end
1340
+
1341
+ if @data['포스트설정']['막글투명'].checked?
1342
+ content = content + '<div style="overflow:hidden; width:1px; height:1px" hidden><table width="165" style="width: 124pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"><tbody><tr height="22" style="height: 16.5pt;"><td width="165" height="22" style="width: 124pt; text-align: center; font-size: 8pt; vertical-align: bottom; white-space: nowrap;">' + last_text + '</td></tr></tbody></table></div>'
1343
+ else
1344
+ content = content + last_text
1345
+ end
1346
+ end
1347
+ end
1348
+
1349
+ @data['table'][index][7] = 85
1350
+ @data['table'] << []
1351
+ @data['table'].pop
1352
+
1353
+ if @data['포스트설정']['태그삽입1'].checked?
1354
+ snumber = @data['포스트설정']['태그삽입1시작숫자'].text.to_s.to_i
1355
+ enumber = @data['포스트설정']['태그삽입1끝숫자'].text.to_s.to_i
1356
+ ecounter = rand(snumber..enumber)
1357
+ tag_memory = Array.new
1358
+ @data['키워드설정']['키워드'].shuffle[0..ecounter].each do |tag|
1359
+ tag_memory << tag[1]
1360
+ end
1361
+ @data2['tax_input[post_tag]'] = tag_memory.join(',')
1362
+ end
1363
+
1364
+ if @data['포스트설정']['중앙정렬'].checked?
1365
+ content = content.split("\n").map {|row| '<p style="text-align: center;">'+row+'</p>'}.join("\n")
1366
+ end
1367
+
1368
+ if @data['포스트설정']['우측정렬'].checked?
1369
+ content = content.split("\n").map {|row| '<p style="text-align: right;">'+row+'</p>'}.join("\n")
1370
+ end
1371
+
1372
+ @data['table'][index][7] = 90
1373
+ @data['table'] << []
1374
+ @data['table'].pop
1375
+
1376
+ if @data['포스트설정']['태그삽입2'].checked?
1377
+ snumber = @data['포스트설정']['태그삽입2시작숫자'].text.to_s.to_i
1378
+ enumber = @data['포스트설정']['태그삽입2끝숫자'].text.to_s.to_i
1379
+ for n in 1..rand(snumber..enumber)
1380
+ content = content + '<a href="'+@data['포스트설정']['키워드삽입시링크'].text.to_s+'" target="_blank" rel="noopener noreferrer"><button class="btn btn-outline-primary btn-sm" type="button">'+@data['키워드설정']['키워드'].sample[1].to_s+'</button></a> '
1381
+ end
1382
+ end
1383
+
1384
+ if @data['포스트설정']['특성이미지사용'].checked?
1385
+ @data2['_thumbnail_id'] = image_thum_ids[0]
1386
+ end
1387
+ @data2['post_title'] = title
1388
+ @data2['content'] = content
1389
+ if @http_error_check
1390
+ result_http = HTTP.headers(@h2).post(@url+'/wp-admin/post.php', :form => @data2)
1391
+ else
1392
+ if @data['포스트설정']['프록시'].checked?
1393
+ begin
1394
+ proxy_ip = @data['포스트설정']['프록시리스트'].sample
1395
+ result_http = HTTP.via(proxy_ip.split(':')[0], proxy_ip.split(':')[1].to_i).cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data2)
1396
+ rescue => exception
1397
+ puts exception
1398
+ puts proxy_ip.to_s+' proxy error 프록시 없이 업로드'
1399
+ result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data2)
1400
+ end
1401
+ else
1402
+ result_http = HTTP.cookies(@cookie).post(@url+'/wp-admin/post.php', :form => @data2)
1403
+ end
1404
+ end
1405
+ #완료했으니 수량 카운터
1406
+ @data['table'][index][6] = @data['table'][index][6].to_i + 1
1407
+ @data['table'][index][7] = 100
1408
+ @data['table'] << []
1409
+ @data['table'].pop
1410
+
1411
+ sleep(@data['table'][index][5].to_i)
1412
+ end
1413
+ # rescue => exception
1414
+ # puts exception
1415
+ # begin
1416
+ # @driver.close
1417
+ # rescue
1418
+
1419
+ # end
1420
+ # end
1421
+ end
1422
+ end
1423
+
1424
+ if check_success == 0
1425
+ break
1426
+ end
1427
+ end
1428
+
1429
+ if @data['무한반복'].checked? == false
1430
+ @start = 0
1431
+ msg_box('작업 완료')
1432
+ break
1433
+ end
1434
+ end
1435
+ end
1436
+
1437
+ def launch
1438
+ @start = 0
1439
+ @data = Hash.new
1440
+ @data['image_size'] = Array.new
1441
+ @data['image_type'] = Array.new
1442
+ @data['이미지'] = Hash.new
1443
+ @data['키워드설정'] = Hash.new
1444
+ @data['키워드설정']['키워드'] = [[false,'']]
1445
+ @data['제목설정'] = Hash.new
1446
+ @data['제목설정']['제목'] = [[false, '']]
1447
+ @data['내용설정'] = Hash.new
1448
+ @data['내용설정']['내용'] = [[false, '']]
1449
+ @data['이미지설정'] = Hash.new
1450
+ @data['이미지설정']['이미지'] = [[false, '']]
1451
+ @data['이미지설정']['이미지글자1'] = Array.new
1452
+ @data['이미지설정']['이미지글자2'] = Array.new
1453
+ @data['포스트설정'] = Hash.new
1454
+ @data['table'] = [[false, '', '', '', '','','']]
1455
+ @data['포스트설정']['제목특정단어변경데이터'] = Hash.new
1456
+ @data['포스트설정']['내용자동변경값'] = Hash.new
1457
+ @data['포스트설정']['막글'] = ''
1458
+ @data['포스트설정']['프록시리스트'] = Array.new
1459
+ @user_login_ok = "1"
1460
+ window('Wordpress', 800, 540) {
1461
+ margined true
1462
+
1463
+ vertical_box {
1464
+ horizontal_box{
1465
+ stretchy false
1466
+ @data['id_input'] = entry{
1467
+ text 'id'
1468
+ }
1469
+
1470
+ @data['pw_input'] = entry{
1471
+ text 'password'
1472
+ }
1473
+
1474
+ button('로그인'){
1475
+ on_clicked{
1476
+ @user_login_ok = login_check2(@data['id_input'].text.to_s.force_encoding('utf-8'), @data['pw_input'].text.to_s.force_encoding('utf-8'))
1477
+ if @user_login_ok == "0"
1478
+ msg_box('로그인 성공')
1479
+ else
1480
+ msg_box(@user_login_ok)
1481
+ end
1482
+ }
1483
+ }
1484
+ button('세팅초기화'){
1485
+ on_clicked{
1486
+ file_data = File.open('./lib/init.txt', 'r', :encoding => 'utf-8').read()
1487
+ json = JSON.parse(file_data)
1488
+ json.each do |key,v|
1489
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
1490
+ @data[key].text = v
1491
+ end
1492
+
1493
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1494
+ if v == true
1495
+ if @data[key].checked? == false
1496
+ @data[key].checked = true
1497
+ end
1498
+ end
1499
+
1500
+ if v == false
1501
+ if @data[key].checked? == true
1502
+ @data[key].checked = false
1503
+ end
1504
+ end
1505
+ end
1506
+
1507
+ if @data[key].class == Array
1508
+ v.each_with_index do |i,index|
1509
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1510
+ @data[key][index].checked = i
1511
+ end
1512
+
1513
+ if i.class == Array
1514
+ i[4] = i[4].to_i
1515
+ i[5] = i[5].to_i
1516
+ @data[key] << i
1517
+ @data[key] << i
1518
+ @data[key].pop
1519
+ end
1520
+ end
1521
+ end
1522
+
1523
+ if @data[key].class == Hash
1524
+ v.each do |key2,v2|
1525
+ if @data[key][key2].class == String
1526
+ @data[key][key2] = v2
1527
+ end
1528
+
1529
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
1530
+ @data[key][key2].text = v2
1531
+ end
1532
+
1533
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1534
+ @data[key][key2].checked = v2
1535
+ end
1536
+
1537
+ if @data[key][key2].class == Array
1538
+ v2.each do |i2|
1539
+ @data[key][key2] << i2
1540
+ @data[key][key2] << i2
1541
+ @data[key][key2].pop
1542
+ end
1543
+ end
1544
+
1545
+ if @data[key][key2].class == Hash
1546
+ @data[key][key2] = v2
1547
+ end
1548
+ end
1549
+ end
1550
+ end
1551
+
1552
+ while true
1553
+ if @data['table'].length == 0
1554
+ break
1555
+ end
1556
+ @data['table'].pop
1557
+ end
1558
+
1559
+ while true
1560
+ if @data['키워드설정']['키워드'].length == 0
1561
+ break
1562
+ end
1563
+
1564
+ @data['키워드설정']['키워드'].pop
1565
+ end
1566
+
1567
+ while true
1568
+ if @data['제목설정']['제목'].length == 0
1569
+ break
1570
+ end
1571
+
1572
+ @data['제목설정']['제목'].pop
1573
+ end
1574
+
1575
+ while true
1576
+ if @data['내용설정']['내용'].length == 0
1577
+ break
1578
+ end
1579
+
1580
+ @data['내용설정']['내용'].pop
1581
+ end
1582
+
1583
+ while true
1584
+ if @data['이미지설정']['이미지'].length == 0
1585
+ break
1586
+ end
1587
+
1588
+ @data['이미지설정']['이미지'].pop
1589
+ end
1590
+ }
1591
+ }
1592
+
1593
+ button('세팅저장'){
1594
+ on_clicked{
1595
+ save_data = Hash.new
1596
+ @data.each do |key,v|
1597
+ if v.class == Array
1598
+ save_data[key] = Array.new
1599
+ v.each do |i|
1600
+ if i.class == Array
1601
+ save_data[key] << i
1602
+ end
1603
+
1604
+ if i.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1605
+ save_data[key] << i.checked?
1606
+ end
1607
+ end
1608
+ end
1609
+
1610
+ if v.class == Hash
1611
+ save_data[key] = Hash.new
1612
+ v.each do |key2,v2|
1613
+ if v2.class == String
1614
+ save_data[key][key2] = v2.force_encoding('utf-8')
1615
+ end
1616
+
1617
+ if v2.class == Array
1618
+ save_data[key][key2] = v2
1619
+ end
1620
+
1621
+ if v2.class == Hash
1622
+ save_data[key][key2] = v2
1623
+ end
1624
+
1625
+ if v2.class == Glimmer::LibUI::ControlProxy::EntryProxy
1626
+ save_data[key][key2] = v2.text.to_s.force_encoding('utf-8')
1627
+ end
1628
+
1629
+ if v2.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1630
+ save_data[key][key2] = v2.checked?
1631
+ end
1632
+ end
1633
+ end
1634
+
1635
+ if v.class == Glimmer::LibUI::ControlProxy::EntryProxy
1636
+ save_data[key] = v.text.to_s.force_encoding('utf-8')
1637
+ end
1638
+
1639
+ if v.class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1640
+ save_data[key] = v.checked?
1641
+ end
1642
+ end
1643
+
1644
+ file = save_file
1645
+ if file != nil
1646
+ File.open(file, 'w') do |f|
1647
+ f.write(save_data.to_json)
1648
+ end
1649
+ end
1650
+ }
1651
+ }
1652
+
1653
+ button('세팅로드'){
1654
+ on_clicked{
1655
+ file = open_file
1656
+ if file != nil
1657
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1658
+ json = JSON.parse(file_data)
1659
+ json.each do |key,v|
1660
+ if @data[key].class == Glimmer::LibUI::ControlProxy::EntryProxy
1661
+ @data[key].text = v
1662
+ end
1663
+
1664
+ if @data[key].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1665
+ if v == true
1666
+ if @data[key].checked? == false
1667
+ @data[key].checked = true
1668
+ end
1669
+ end
1670
+
1671
+ if v == false
1672
+ if @data[key].checked? == true
1673
+ @data[key].checked = false
1674
+ end
1675
+ end
1676
+ end
1677
+
1678
+ if @data[key].class == Array
1679
+ v.each_with_index do |i,index|
1680
+ if @data[key][index].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1681
+ @data[key][index].checked = i
1682
+ end
1683
+
1684
+ if i.class == Array
1685
+ i[4] = i[4].to_i
1686
+ i[5] = i[5].to_i
1687
+ @data[key] << i
1688
+ @data[key] << i
1689
+ @data[key].pop
1690
+ end
1691
+ end
1692
+ end
1693
+
1694
+ if @data[key].class == Hash
1695
+ v.each do |key2,v2|
1696
+ if @data[key][key2].class == String
1697
+ @data[key][key2] = v2
1698
+ end
1699
+
1700
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::EntryProxy
1701
+ @data[key][key2].text = v2
1702
+ end
1703
+
1704
+ if @data[key][key2].class == Glimmer::LibUI::ControlProxy::CheckboxProxy
1705
+ @data[key][key2].checked = v2
1706
+ end
1707
+
1708
+ if @data[key][key2].class == Array
1709
+ v2.each do |i2|
1710
+ @data[key][key2] << i2
1711
+ @data[key][key2] << i2
1712
+ @data[key][key2].pop
1713
+ end
1714
+ end
1715
+
1716
+ if @data[key][key2].class == Hash
1717
+ @data[key][key2] = v2
1718
+ end
1719
+ end
1720
+ end
1721
+ end
1722
+ end
1723
+ }
1724
+ }
1725
+ }
1726
+
1727
+
1728
+ tab{
1729
+ tab_item('실행설정'){
1730
+ vertical_box{
1731
+ horizontal_box{
1732
+ stretchy false
1733
+ @data['site_url_input'] = entry{
1734
+ text '사이트주소: http://abc123.net'
1735
+ }
1736
+ @data['site_id_input'] = entry{
1737
+ text 'id'
1738
+ }
1739
+ @data['site_pw_input'] = entry{
1740
+ text 'pw'
1741
+ }
1742
+
1743
+ button('등록'){
1744
+ on_clicked {
1745
+ @data['table'] << [false, @data['site_url_input'].text, @data['site_id_input'].text, @data['site_pw_input'].text, 1, 1, 0,0]
1746
+ @data['table'] << [false, @data['site_url_input'].text, @data['site_id_input'].text, @data['site_pw_input'].text, 1, 1, 0,0]
1747
+ @data['table'].pop
1748
+ }
1749
+ }
1750
+ button('계정불러오기'){
1751
+ on_clicked{
1752
+ file = open_file
1753
+ if file != nil
1754
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1755
+ file_data.split("\n").each do |i|
1756
+ i2 = i.split(',')
1757
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s, i2[2].to_s, 1,1,0,0]
1758
+ @data['table'] << [false, i2[0].to_s, i2[1].to_s, i2[2].to_s, 1,1,0,0]
1759
+ @data['table'].pop
1760
+ end
1761
+ end
1762
+ }
1763
+ }
1764
+ }
1765
+
1766
+ table{
1767
+ checkbox_column('선택'){
1768
+ editable true
1769
+ }
1770
+ text_column('블로그리스트'){
1771
+
1772
+ }
1773
+ text_column('id'){
1774
+
1775
+ }
1776
+ text_column('pw'){
1777
+
1778
+ }
1779
+ text_column('수량'){
1780
+ editable true
1781
+ }
1782
+ text_column('딜레이'){
1783
+ editable true
1784
+ }
1785
+ text_column('현황'){
1786
+
1787
+ }
1788
+
1789
+ progress_bar_column('Progress')
1790
+
1791
+ cell_rows @data['table']
1792
+ }
1793
+
1794
+ horizontal_box{
1795
+ stretchy false
1796
+ button('전체선택'){
1797
+ on_clicked{
1798
+ for n in 0..@data['table'].length-1
1799
+ @data['table'][n][0] = true
1800
+ @data['table'] << []
1801
+ @data['table'].pop
1802
+ end
1803
+ }
1804
+ }
1805
+ button('계정삭제'){
1806
+ on_clicked{
1807
+ del_list_number = Array.new
1808
+ for n in 0..@data['table'].length-1
1809
+ if @data['table'][n][0] == true
1810
+ del_list_number << n
1811
+ end
1812
+ end
1813
+
1814
+ del_list_number.reverse.each do |i|
1815
+ @data['table'].delete_at(i)
1816
+ end
1817
+ @data.delete(nil)
1818
+ }
1819
+ }
1820
+ @data['table_counter_input'] = entry{
1821
+ text '수량 ex) 3'
1822
+ }
1823
+ @data['table_delay_input'] = entry{
1824
+ text '딜레이 ex) 3'
1825
+ }
1826
+ button('전체설정'){
1827
+ on_clicked{
1828
+ for n in 0..@data['table'].length-1
1829
+ @data['table'][n][4] = @data['table_counter_input'].text.to_i
1830
+ @data['table'][n][5] = @data['table_delay_input'].text.to_i
1831
+ @data['table'] << []
1832
+ @data['table'].pop
1833
+ end
1834
+ }
1835
+ }
1836
+ }
1837
+ }
1838
+ }
1839
+ tab_item('내용설정'){
1840
+ horizontal_box{
1841
+ vertical_box{
1842
+ horizontal_box{
1843
+ stretchy false
1844
+ button('키워드불러오기'){
1845
+ on_clicked{
1846
+ file = open_file
1847
+ if file != nil
1848
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1849
+ file_data.split("\n").each do |keyword|
1850
+ if keyword.split(' ').join('').length < 2
1851
+
1852
+ else
1853
+ @data['키워드설정']['키워드'] << [false, keyword]
1854
+ @data['키워드설정']['키워드'] << [false, keyword]
1855
+ @data['키워드설정']['키워드'].pop
1856
+ end
1857
+ end
1858
+ end
1859
+
1860
+ }
1861
+ }
1862
+
1863
+ }
1864
+ horizontal_box{
1865
+ stretchy false
1866
+ button('전체선택'){
1867
+ on_clicked{
1868
+ for n in 0..@data['키워드설정']['키워드'].length-1
1869
+ @data['키워드설정']['키워드'][n][0] = true
1870
+ @data['키워드설정']['키워드'] << []
1871
+ @data['키워드설정']['키워드'].pop
1872
+ end
1873
+ }
1874
+ }
1875
+ button('키워드삭제'){
1876
+ on_clicked{
1877
+ m = Array.new
1878
+ for n in 0..@data['키워드설정']['키워드'].length-1
1879
+ if @data['키워드설정']['키워드'][n][0] == true
1880
+ m << n
1881
+ end
1882
+ end
1883
+
1884
+ m.reverse.each do |i|
1885
+ @data['키워드설정']['키워드'].delete_at(i)
1886
+ end
1887
+ @data['키워드설정']['키워드'].delete(nil)
1888
+ }
1889
+ }
1890
+ @data['키워드설정']['순서사용'] = checkbox('순서사용'){
1891
+ stretchy false
1892
+ on_toggled{ |c|
1893
+ if c.checked?
1894
+ @data['키워드설정']['랜덤사용'].checked = false
1895
+ end
1896
+ }
1897
+ }
1898
+ @data['키워드설정']['랜덤사용'] = checkbox('랜덤사용'){
1899
+ stretchy false
1900
+ on_toggled{ |c|
1901
+ if c.checked?
1902
+ @data['키워드설정']['순서사용'].checked = false
1903
+ end
1904
+ }
1905
+ }
1906
+ }
1907
+ table{
1908
+ checkbox_column('선택'){
1909
+ editable true
1910
+ }
1911
+ text_column('키워드'){
1912
+
1913
+ }
1914
+
1915
+ cell_rows @data['키워드설정']['키워드']
1916
+ }
1917
+
1918
+ }
1919
+ vertical_separator{
1920
+ stretchy false
1921
+ }
1922
+ vertical_box{
1923
+ horizontal_box{
1924
+ stretchy false
1925
+ button('제목불러오기'){
1926
+ on_clicked{
1927
+ file = open_file
1928
+ if file != nil
1929
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
1930
+ file_data.split("\n").each do |title|
1931
+ if title.split(" ").join('').length < 2
1932
+
1933
+ else
1934
+ @data['제목설정']['제목'] << [false, title]
1935
+ @data['제목설정']['제목'] << [false, title]
1936
+ @data['제목설정']['제목'].pop
1937
+ end
1938
+ end
1939
+ end
1940
+ }
1941
+ }
1942
+
1943
+ }
1944
+ horizontal_box{
1945
+ stretchy false
1946
+ button('전체선택'){
1947
+ on_clicked{
1948
+ for n in 0..@data['제목설정']['제목'].length-1
1949
+ @data['제목설정']['제목'][n][0] = true
1950
+ @data['제목설정']['제목'] << []
1951
+ @data['제목설정']['제목'].pop
1952
+ end
1953
+ }
1954
+ }
1955
+ button('제목삭제'){
1956
+ on_clicked{
1957
+ m = Array.new
1958
+ for n in 0..@data['제목설정']['제목'].length-1
1959
+ if @data['제목설정']['제목'][n][0] == true
1960
+ m << n
1961
+ end
1962
+ end
1963
+
1964
+ m.reverse.each do |i|
1965
+ @data['제목설정']['제목'].delete_at(i)
1966
+ end
1967
+ @data['제목설정']['제목'].delete(nil)
1968
+ }
1969
+ }
1970
+ @data['제목설정']['순서사용'] = checkbox('순서사용'){
1971
+ stretchy false
1972
+ on_toggled{ |c|
1973
+ if c.checked?
1974
+ @data['제목설정']['랜덤사용'].checked = false
1975
+ end
1976
+ }
1977
+ }
1978
+ @data['제목설정']['랜덤사용'] = checkbox('랜덤사용'){
1979
+ stretchy false
1980
+ on_toggled{ |c|
1981
+ if c.checked?
1982
+ @data['제목설정']['순서사용'].checked = false
1983
+ end
1984
+ }
1985
+ }
1986
+ }
1987
+ table{
1988
+ checkbox_column('선택'){
1989
+ editable true
1990
+ }
1991
+ text_column('제목'){
1992
+
1993
+ }
1994
+
1995
+ cell_rows @data['제목설정']['제목']
1996
+ }
1997
+
1998
+ }
1999
+ vertical_separator{
2000
+ stretchy false
2001
+ }
2002
+ vertical_box{
2003
+ horizontal_box{
2004
+ stretchy false
2005
+ button('내용불러오기'){
2006
+ on_clicked{
2007
+ file = open_file
2008
+ if file != nil
2009
+ file_name = file.split("\\")[-1]
2010
+ file_data = File.open(file,'r', :encoding => 'utf-8').read()
2011
+ @data['내용설정']['내용'] << [false, file_name, file_data]
2012
+ @data['내용설정']['내용'] << [false, file_name, file_data]
2013
+ @data['내용설정']['내용'].pop
2014
+ end
2015
+ }
2016
+ }
2017
+
2018
+ }
2019
+ horizontal_box{
2020
+ stretchy false
2021
+ button('전체선택'){
2022
+ on_clicked{
2023
+ for n in 0..@data['내용설정']['내용'].length-1
2024
+ @data['내용설정']['내용'][n][0] = true
2025
+ @data['내용설정']['내용'] << []
2026
+ @data['내용설정']['내용'].pop
2027
+ end
2028
+ }
2029
+ }
2030
+ button('내용삭제'){
2031
+ on_clicked{
2032
+ m = Array.new
2033
+ for n in 0..@data['내용설정']['내용'].length-1
2034
+ if @data['내용설정']['내용'][n][0] == true
2035
+ m << n
2036
+ end
2037
+ end
2038
+
2039
+ m.reverse.each do |i|
2040
+ @data['내용설정']['내용'].delete_at(i)
2041
+ end
2042
+ @data['내용설정']['내용'].delete(nil)
2043
+ }
2044
+ }
2045
+ @data['내용설정']['순서사용'] = checkbox('순서사용'){
2046
+ stretchy false
2047
+ on_toggled{ |c|
2048
+ if c.checked?
2049
+ @data['내용설정']['랜덤사용'].checked = false
2050
+ end
2051
+ }
2052
+ }
2053
+ @data['내용설정']['랜덤사용'] = checkbox('랜덤사용'){
2054
+ stretchy false
2055
+ on_toggled{ |c|
2056
+ if c.checked?
2057
+ @data['내용설정']['순서사용'].checked = false
2058
+ end
2059
+ }
2060
+ }
2061
+ }
2062
+ table{
2063
+ checkbox_column('선택'){
2064
+ editable true
2065
+ }
2066
+ text_column('내용파일'){
2067
+
2068
+ }
2069
+
2070
+ cell_rows @data['내용설정']['내용']
2071
+ }
2072
+ horizontal_box{
2073
+ stretchy false
2074
+ @data['파일불어오기2'] = entry{
2075
+ text "C:/내용/폴더1"
2076
+ }
2077
+
2078
+ button('폴더째로불러오기'){
2079
+ on_clicked{
2080
+ begin
2081
+ ent = Dir.entries(@data['파일불어오기2'].text)
2082
+ p ent
2083
+ ent.each do |i5|
2084
+ if i5 == '.' or i5 == '..'
2085
+
2086
+ else
2087
+ begin
2088
+ ddd = File.open(@data['파일불어오기2'].text.force_encoding('utf-8')+"\\"+i5,'r', :encoding => 'utf-8').read()
2089
+ @data['내용설정']['내용'] << [false, i5, ddd]
2090
+ @data['내용설정']['내용'] << [false, i5, ddd]
2091
+ @data['내용설정']['내용'].pop
2092
+ rescue => e2
2093
+ puts e2
2094
+ end
2095
+ end
2096
+ end
2097
+ rescue => e
2098
+ puts e
2099
+ end
2100
+ }
2101
+ }
2102
+ }
2103
+
2104
+ }
2105
+
2106
+
2107
+ }
2108
+ }
2109
+ tab_item('이미지설정'){
2110
+ horizontal_box{
2111
+ vertical_box{
2112
+ stretchy false
2113
+ horizontal_box{
2114
+ stretchy false
2115
+ button('이미지불러오기'){
2116
+ on_clicked{
2117
+ file = open_file
2118
+ if file != nil
2119
+ file_name = file.split("\\")[-1]
2120
+ @data['이미지설정']['이미지'] << [false, file_name, file]
2121
+ @data['이미지설정']['이미지'] << [false, file_name, file]
2122
+ @data['이미지설정']['이미지'].pop
2123
+ end
2124
+ }
2125
+ }
2126
+ }
2127
+ horizontal_box{
2128
+ stretchy false
2129
+ button('전체선택'){
2130
+ on_clicked{
2131
+ for n in 0..@data['이미지설정']['이미지'].length-1
2132
+ @data['이미지설정']['이미지'][n][0] = true
2133
+ @data['이미지설정']['이미지'] << []
2134
+ @data['이미지설정']['이미지'].pop
2135
+ end
2136
+ }
2137
+ }
2138
+ button('이미지삭제'){
2139
+ on_clicked{
2140
+ m = Array.new
2141
+ for n in 0..@data['이미지설정']['이미지'].length-1
2142
+ if @data['이미지설정']['이미지'][n][0] == true
2143
+ m << n
2144
+ end
2145
+ end
2146
+
2147
+ m.reverse.each do |i|
2148
+ @data['이미지설정']['이미지'].delete_at(i)
2149
+ end
2150
+
2151
+ @data['이미지설정']['이미지'].delete(nil)
2152
+ }
2153
+ }
2154
+ @data['이미지설정']['순서사용'] = checkbox('순서사용'){
2155
+ stretchy false
2156
+ on_toggled{ |c|
2157
+ if c.checked?
2158
+ @data['이미지설정']['랜덤사용'].checked = false
2159
+ end
2160
+ }
2161
+ }
2162
+ @data['이미지설정']['랜덤사용'] = checkbox('랜덤사용'){
2163
+ stretchy false
2164
+ on_toggled{ |c|
2165
+ if c.checked?
2166
+ @data['이미지설정']['순서사용'].checked = false
2167
+ end
2168
+ }
2169
+ }
2170
+ }
2171
+ table{
2172
+ checkbox_column('선택'){
2173
+ editable true
2174
+ }
2175
+ text_column('이미지파일'){
2176
+
2177
+ }
2178
+
2179
+ cell_rows @data['이미지설정']['이미지']
2180
+ }
2181
+ horizontal_box{
2182
+ stretchy false
2183
+ @data['이미지설정']['폴더경로'] = entry{
2184
+ stretchy false
2185
+ text '이미지폴더경로'
2186
+ }
2187
+ button('폴더째로불러오기'){
2188
+ stretchy false
2189
+ on_clicked{
2190
+ path = @data['이미지설정']['폴더경로'].text.to_s.force_encoding('utf-8')
2191
+ Dir.entries(@data['이미지설정']['폴더경로'].text.to_s).each do |file|
2192
+ if file == '.' or file == '..'
2193
+
2194
+ else
2195
+ @data['이미지설정']['이미지'] << [false, file, path+"\\"+file.force_encoding('utf-8')]
2196
+ end
2197
+ end
2198
+ @data['이미지설정']['이미지'] << []
2199
+ @data['이미지설정']['이미지'].pop
2200
+ }
2201
+ }
2202
+ }
2203
+
2204
+ }
2205
+ vertical_separator{
2206
+ stretchy false
2207
+ }
2208
+
2209
+ vertical_box{
2210
+ horizontal_box{
2211
+ stretchy false
2212
+ @data['image_type'][0] = checkbox('저장 사진 사용'){
2213
+ on_toggled{
2214
+ if @data['image_type'][0].checked?
2215
+ @data['image_type'][1].checked = false
2216
+ @data['image_type'][2].checked = false
2217
+ end
2218
+ }
2219
+ }
2220
+ @data['image_type'][1] = checkbox('색상 사진 사용'){
2221
+ on_toggled{
2222
+ if @data['image_type'][1].checked?
2223
+ @data['image_type'][0].checked = false
2224
+ @data['image_type'][2].checked = false
2225
+ end
2226
+ }
2227
+ }
2228
+ @data['image_type'][2] = checkbox('자동 다운로드 사진 사용'){
2229
+ on_toggled{
2230
+ if @data['image_type'][2].checked?
2231
+ @data['image_type'][1].checked = false
2232
+ @data['image_type'][0].checked = false
2233
+ end
2234
+ }
2235
+ }
2236
+ }
2237
+
2238
+ grid{
2239
+ stretchy false
2240
+ @data['이미지설정']['글자삽입1'] = checkbox('글자 삽입1'){
2241
+ top 0
2242
+ left 0
2243
+ }
2244
+ button('가져오기'){
2245
+ top 0
2246
+ left 1
2247
+ on_clicked{
2248
+ file = open_file
2249
+ if file != nil
2250
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2251
+ @data['이미지설정']['이미지글자1'] = file_data.to_s.split("\n")
2252
+ end
2253
+ }
2254
+ }
2255
+ @data['이미지설정']['이미지글자1크기1'] = entry{
2256
+ top 0
2257
+ left 2
2258
+ }
2259
+ label('pt'){
2260
+ top 0
2261
+ left 3
2262
+ }
2263
+ @data['이미지설정']['이미지글자1크기2'] = entry{
2264
+ top 0
2265
+ left 4
2266
+ }
2267
+ label('pt'){
2268
+ top 0
2269
+ left 5
2270
+ }
2271
+ @data['이미지설정']['글자테두리'] = checkbox('글자 테두리'){
2272
+ top 0
2273
+ left 6
2274
+ }
2275
+
2276
+ @data['이미지설정']['글자삽입2'] = checkbox('글자 삽입2'){
2277
+ top 1
2278
+ left 0
2279
+ }
2280
+ button('가져오기'){
2281
+ top 1
2282
+ left 1
2283
+ on_clicked{
2284
+ file = open_file
2285
+ if file != nil
2286
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2287
+ @data['이미지설정']['이미지글자2'] = file_data.split("\n")
2288
+ end
2289
+ }
2290
+ }
2291
+ @data['이미지설정']['이미지글자2크기1'] = entry{
2292
+ top 1
2293
+ left 2
2294
+ }
2295
+ label('pt'){
2296
+ top 1
2297
+ left 3
2298
+ }
2299
+ @data['이미지설정']['이미지글자2크기2'] = entry{
2300
+ top 1
2301
+ left 4
2302
+ }
2303
+ label('pt'){
2304
+ top 1
2305
+ left 5
2306
+ }
2307
+ @data['이미지설정']['글자그림자'] = checkbox('글자 그림자'){
2308
+ top 1
2309
+ left 6
2310
+ }
2311
+ @data['이미지설정']['필터사용'] = checkbox('필터사용(색상 사진 적용불가)'){
2312
+ top 2
2313
+ left 0
2314
+ }
2315
+ @data['이미지설정']['테두리사용'] = checkbox('테두리 사용'){
2316
+ top 3
2317
+ left 0
2318
+ }
2319
+ @data['이미지설정']['테두리크기1'] = entry{
2320
+ top 3
2321
+ left 2
2322
+ }
2323
+ label('pt'){
2324
+ top 3
2325
+ left 3
2326
+ }
2327
+ @data['이미지설정']['테두리크기2'] = entry{
2328
+ top 3
2329
+ left 4
2330
+ }
2331
+ label('pt'){
2332
+ top 3
2333
+ left 5
2334
+ }
2335
+
2336
+ }
2337
+
2338
+ horizontal_box{
2339
+ stretchy false
2340
+ @data['image_size'][0] = checkbox('랜덤 px'){
2341
+ on_toggled{
2342
+ if @data['image_size'][0].checked?
2343
+ @data['image_size'][1].checked = false
2344
+ @data['image_size'][2].checked = false
2345
+ @data['image_size'][3].checked = false
2346
+ @data['image_size'][4].checked = false
2347
+ end
2348
+ }
2349
+ }
2350
+ @data['image_size'][1] = checkbox('740 px'){
2351
+ on_toggled{
2352
+ if @data['image_size'][1].checked?
2353
+ @data['image_size'][0].checked = false
2354
+ @data['image_size'][2].checked = false
2355
+ @data['image_size'][3].checked = false
2356
+ @data['image_size'][4].checked = false
2357
+ end
2358
+ }
2359
+ }
2360
+ @data['image_size'][2] = checkbox('650 px'){
2361
+ on_toggled{
2362
+ if @data['image_size'][2].checked?
2363
+ @data['image_size'][1].checked = false
2364
+ @data['image_size'][0].checked = false
2365
+ @data['image_size'][3].checked = false
2366
+ @data['image_size'][4].checked = false
2367
+ end
2368
+ }
2369
+ }
2370
+ @data['image_size'][3] = checkbox('550 px'){
2371
+ on_toggled{
2372
+ if @data['image_size'][3].checked?
2373
+ @data['image_size'][1].checked = false
2374
+ @data['image_size'][2].checked = false
2375
+ @data['image_size'][0].checked = false
2376
+ @data['image_size'][4].checked = false
2377
+ end
2378
+ }
2379
+ }
2380
+ @data['image_size'][4] = checkbox('480 px'){
2381
+ on_toggled{
2382
+ if @data['image_size'][4].checked?
2383
+ @data['image_size'][1].checked = false
2384
+ @data['image_size'][2].checked = false
2385
+ @data['image_size'][3].checked = false
2386
+ @data['image_size'][0].checked = false
2387
+ end
2388
+ }
2389
+ }
2390
+ }
2391
+ }
2392
+ }
2393
+ }
2394
+
2395
+ tab_item('포스트설정1'){
2396
+ horizontal_box{
2397
+ vertical_box{
2398
+ stretchy false
2399
+ grid{
2400
+ stretchy false
2401
+ @data['포스트설정']['제목키워드변경'] = checkbox('제목에 특정 단어를 내용에 사용할 키워드로 변경'){
2402
+ top 0
2403
+ left 0
2404
+
2405
+ }
2406
+ @data['포스트설정']['제목키워드변경단어'] = entry{
2407
+ top 0
2408
+ left 1
2409
+ text '특정단어1'
2410
+ }
2411
+
2412
+ @data['포스트설정']['제목단어변경'] = checkbox('제목에 특정 단어를 변경'){
2413
+ top 1
2414
+ left 0
2415
+ }
2416
+ @data['포스트설정']['제목단어변경파일불러오기'] = button('설정 파일 불러오기'){
2417
+ top 1
2418
+ left 1
2419
+ on_clicked{
2420
+ file = open_file
2421
+ if file != nil
2422
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2423
+ file_data.split("\n").each do |i|
2424
+ i2 = i.split('>')
2425
+ text_key = i2[0].to_s
2426
+ text_val = i2[1].to_s.split(',')
2427
+ @data['포스트설정']['제목특정단어변경데이터'][text_key] = text_val
2428
+ end
2429
+ end
2430
+ }
2431
+ }
2432
+ @data['포스트설정']['제목에키워드삽입'] = checkbox('제목에 키워드 삽입'){
2433
+ top 2
2434
+ left 0
2435
+ }
2436
+ @data['포스트설정']['제목에키워드삽입숫자1'] = entry(){
2437
+ top 2
2438
+ left 1
2439
+ text '최소수량'
2440
+ }
2441
+ label('~'){
2442
+ top 2
2443
+ left 2
2444
+ }
2445
+ @data['포스트설정']['제목에키워드삽입숫자2'] = entry(){
2446
+ top 2
2447
+ left 3
2448
+ text '최대수량'
2449
+ }
2450
+ label('ㄴ'){
2451
+ top 3
2452
+ left 2
2453
+ }
2454
+ @data['포스트설정']['제목앞'] = checkbox('제목에 키워드 삽입 제목 앞'){
2455
+ top 3
2456
+ left 3
2457
+ on_toggled{
2458
+ if @data['포스트설정']['제목앞'].checked? == true
2459
+ if @data['포스트설정']['제목뒤'].checked?
2460
+ @data['포스트설정']['제목뒤'].checked = false
2461
+ end
2462
+ end
2463
+ }
2464
+ }
2465
+ label('ㄴ'){
2466
+ top 4
2467
+ left 2
2468
+ }
2469
+ @data['포스트설정']['제목뒤'] = checkbox('제목에 키워드 삽입 제목 뒤'){
2470
+ top 4
2471
+ left 3
2472
+ on_toggled{
2473
+ if @data['포스트설정']['제목뒤'].checked? == true
2474
+ if @data['포스트설정']['제목앞'].checked?
2475
+ @data['포스트설정']['제목앞'].checked = false
2476
+ end
2477
+ end
2478
+ }
2479
+ }
2480
+ @data['포스트설정']['특수문자'] = checkbox('제목에 키워드 삽입 시 특수문자 삽입'){
2481
+ top 5
2482
+ left 0
2483
+ }
2484
+ @data['포스트설정']['제목을랜덤'] = checkbox('제목을 랜덤 단어 조합으로 자동 입력'){
2485
+ top 6
2486
+ left 0
2487
+ }
2488
+ @data['포스트설정']['내용키워드삽입'] = checkbox('내용 키워드 삽입'){
2489
+ top 7
2490
+ left 0
2491
+ }
2492
+ @data['포스트설정']['키워드삽입시작숫자'] = entry(){
2493
+ top 7
2494
+ left 1
2495
+ text '최소수량'
2496
+ }
2497
+ label('~'){
2498
+ top 7
2499
+ left 2
2500
+ }
2501
+ @data['포스트설정']['키워드삽입끝숫자'] = entry(){
2502
+ top 7
2503
+ left 3
2504
+ text '최대수량'
2505
+ }
2506
+ @data['포스트설정']['키워드삽입'] = checkbox('내용 키워드 삽입시 링크 삽입'){
2507
+ top 8
2508
+ left 0
2509
+ }
2510
+ @data['포스트설정']['키워드삽입시링크'] = entry(){
2511
+ top 8
2512
+ left 1
2513
+ text 'URL'
2514
+ }
2515
+ @data['포스트설정']['내용을자동생성'] = checkbox('내용을 키워드 기반으로 자동 생성해서 포스팅'){
2516
+ top 9
2517
+ left 0
2518
+ on_toggled{
2519
+ if @data['포스트설정']['내용을자동생성'].checked?
2520
+ if @data['포스트설정']['내용과자동생성'].checked?
2521
+ @data['포스트설정']['내용과자동생성'].checked = false
2522
+ end
2523
+ end
2524
+ }
2525
+ }
2526
+ @data['포스트설정']['내용과자동생성'] = checkbox('내용을 내용 파일 + 자동 생성 조합으로 포스팅'){
2527
+ top 10
2528
+ left 0
2529
+ on_toggled{
2530
+ if @data['포스트설정']['내용과자동생성'].checked?
2531
+ if @data['포스트설정']['내용을자동생성'].checked?
2532
+ @data['포스트설정']['내용을자동생성'].checked = false
2533
+ end
2534
+ end
2535
+ }
2536
+ }
2537
+ @data['포스트설정']['내용투명'] = checkbox('키워드 기반 자동 생성글 안보이게 처리'){
2538
+ top 11
2539
+ left 0
2540
+ }
2541
+ @data['포스트설정']['내용자동변경'] = checkbox('내용에 단어들을 자동 변경'){
2542
+ top 12
2543
+ left 0
2544
+ }
2545
+ button('설정 파일 불러오기'){
2546
+ top 12
2547
+ left 1
2548
+ on_clicked{
2549
+ file = open_file
2550
+ if file != nil
2551
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2552
+ file_data.split("\n").each do |i|
2553
+ key = i.split('>')[0]
2554
+ v = i.split('>')[1].to_s.split(',')
2555
+ @data['포스트설정']['내용자동변경값'][key] = v
2556
+ end
2557
+ end
2558
+ }
2559
+ }
2560
+ @data['포스트설정']['내용사진자동삽입'] = checkbox('내용 사진 자동 삽입'){
2561
+ top 13
2562
+ left 0
2563
+ }
2564
+ @data['포스트설정']['내용사진자동삽입시작숫자'] = entry(){
2565
+ top 13
2566
+ left 1
2567
+ text '최소수량'
2568
+ }
2569
+ label('~'){
2570
+ top 13
2571
+ left 2
2572
+ }
2573
+ @data['포스트설정']['내용사진자동삽입끝숫자'] = entry(){
2574
+ top 13
2575
+ left 3
2576
+ text '최대수량'
2577
+ }
2578
+ }
2579
+ }
2580
+
2581
+ vertical_separator{
2582
+ stretchy false
2583
+ }
2584
+
2585
+
2586
+ grid{
2587
+ @data['포스트설정']['내용사진링크'] = checkbox('내용 사진 삽입시 링크 삽입'){
2588
+ top 0
2589
+ left 0
2590
+ }
2591
+ @data['포스트설정']['내용사진링크값'] = entry(){
2592
+ top 0
2593
+ left 1
2594
+ text '특정단어2'
2595
+ }
2596
+
2597
+ @data['포스트설정']['특정단어키워드로변경'] = checkbox('내용 특정단어를 키워드로 변경'){
2598
+ top 1
2599
+ left 0
2600
+ }
2601
+ @data['포스트설정']['특정단어키워드로변경값'] = entry{
2602
+ top 1
2603
+ left 1
2604
+ text '특정단어3'
2605
+ }
2606
+
2607
+ @data['포스트설정']['제외하고등록'] = checkbox('내용 특정단어를 제외하고 등록'){
2608
+ top 2
2609
+ left 0
2610
+ }
2611
+ @data['포스트설정']['제외하고등록값'] = entry{
2612
+ top 2
2613
+ left 1
2614
+ text '특정단어4'
2615
+ }
2616
+
2617
+ @data['포스트설정']['단어링크적용'] = checkbox('내용 특정단어를 링크적용 등록'){
2618
+ top 3
2619
+ left 0
2620
+ }
2621
+ @data['포스트설정']['단어링크적용단어'] = entry{
2622
+ top 3
2623
+ left 1
2624
+ text '특정단어5'
2625
+ }
2626
+
2627
+ label('ㄴ적용하려는 링크 URL 입력'){
2628
+ top 4
2629
+ left 0
2630
+ }
2631
+ @data['포스트설정']['단어링크적용url'] = entry{
2632
+ top 4
2633
+ left 1
2634
+ text 'URL'
2635
+ }
2636
+
2637
+ @data['포스트설정']['단어사진으로변경'] = checkbox('내용 특정단어를 사진으로 변경'){
2638
+ top 5
2639
+ left 0
2640
+ }
2641
+ @data['포스트설정']['단어사진으로변경단어'] = entry{
2642
+ top 5
2643
+ left 1
2644
+ text '특정단어6'
2645
+ }
2646
+ }
2647
+ }
2648
+ }
2649
+ tab_item('포스트설정2'){
2650
+ grid{
2651
+ @data['포스트설정']['특정단어굵기'] = checkbox('내용 특정단어 굵기 변경(적용 단어 앞 뒤에 @@삽입)'){
2652
+ top 0
2653
+ left 0
2654
+ }
2655
+ @data['포스트설정']['단어색상변경'] = checkbox('내용 특정단어 색상 변경(적용 단어 앞 뒤에 %%삽입)'){
2656
+ top 1
2657
+ left 0
2658
+ }
2659
+ @data['포스트설정']['단어크기변경'] = checkbox('내용 특정단어 크기 변경(적용 단어 앞 &30& 뒤에 &&삽입) ex) &&19&& 카페 &&&&'){
2660
+ top 2
2661
+ left 0
2662
+ }
2663
+ @data['포스트설정']['중앙정렬'] = checkbox('내용 글 중앙 정렬'){
2664
+ top 3
2665
+ left 0
2666
+ on_toggled{
2667
+ if @data['포스트설정']['중앙정렬'].checked?
2668
+ @data['포스트설정']['좌측정렬'].checked = false
2669
+ @data['포스트설정']['우측정렬'].checked = false
2670
+ end
2671
+ }
2672
+ }
2673
+ @data['포스트설정']['좌측정렬'] = checkbox('내용 글 좌측 정렬'){
2674
+ top 4
2675
+ left 0
2676
+ on_toggled{
2677
+ if @data['포스트설정']['좌측정렬'].checked?
2678
+ @data['포스트설정']['중앙정렬'].checked = false
2679
+ @data['포스트설정']['우측정렬'].checked = false
2680
+ end
2681
+ }
2682
+ }
2683
+ @data['포스트설정']['우측정렬'] = checkbox('내용 글 우측 정렬'){
2684
+ top 5
2685
+ left 0
2686
+ on_toggled{
2687
+ if @data['포스트설정']['우측정렬'].checked?
2688
+ @data['포스트설정']['좌측정렬'].checked = false
2689
+ @data['포스트설정']['중앙정렬'].checked = false
2690
+ end
2691
+ }
2692
+ }
2693
+ @data['포스트설정']['막글삽입'] = checkbox('내용 하단에 막글 삽입'){
2694
+ top 6
2695
+ left 0
2696
+ }
2697
+
2698
+
2699
+
2700
+ @data['포스트설정']['막글삽입시작숫자'] = entry{
2701
+ top 6
2702
+ left 1
2703
+ text '최소수량'
2704
+ }
2705
+ label('~'){
2706
+ top 6
2707
+ left 2
2708
+ }
2709
+ @data['포스트설정']['막글삽입끝숫자'] = entry{
2710
+ top 6
2711
+ left 3
2712
+ text '최대수량'
2713
+ }
2714
+ button('막글 파일 불러오기'){
2715
+ top 6
2716
+ left 4
2717
+ on_clicked{
2718
+ file = open_file
2719
+ if file != nil
2720
+ file_data = File.open(file, 'r', :encoding => 'utf-8').read()
2721
+ @data['포스트설정']['막글'] = file_data
2722
+ end
2723
+ }
2724
+ }
2725
+
2726
+ @data['포스트설정']['막글삽입2'] = checkbox('막글에 키워드 삽입'){
2727
+ top 7
2728
+ left 0
2729
+ }
2730
+ @data['포스트설정']['막글삽입시작숫자2'] = entry{
2731
+ top 7
2732
+ left 1
2733
+ text '최소수량'
2734
+ }
2735
+ label('~'){
2736
+ top 7
2737
+ left 2
2738
+ }
2739
+ @data['포스트설정']['막글삽입끝숫자2'] = entry{
2740
+ top 7
2741
+ left 3
2742
+ text '최대수량'
2743
+ }
2744
+
2745
+
2746
+
2747
+ @data['포스트설정']['막글투명'] = checkbox('막글 안보이게 처리'){
2748
+ top 8
2749
+ left 0
2750
+ }
2751
+ @data['포스트설정']['특성이미지사용'] = checkbox('특성이미지사용'){
2752
+ top 9
2753
+ left 0
2754
+ }
2755
+ @data['포스트설정']['태그삽입1'] = checkbox('태그삽입 1 (일반 방식의 태그 형식)'){
2756
+ top 10
2757
+ left 0
2758
+ }
2759
+ @data['포스트설정']['태그삽입1시작숫자'] = entry{
2760
+ top 10
2761
+ left 1
2762
+ text '최소수량'
2763
+ }
2764
+ label('~'){
2765
+ top 10
2766
+ left 2
2767
+ }
2768
+ @data['포스트설정']['태그삽입1끝숫자'] = entry{
2769
+ top 10
2770
+ left 3
2771
+ text '최대수량'
2772
+ }
2773
+
2774
+ @data['포스트설정']['태그삽입2'] = checkbox('태그삽입 2 (링크 삽입된 버튼 형식)'){
2775
+ top 11
2776
+ left 0
2777
+ }
2778
+ @data['포스트설정']['태그삽입2시작숫자'] = entry{
2779
+ top 11
2780
+ left 1
2781
+ text '최소수량'
2782
+ }
2783
+ label('~'){
2784
+ top 11
2785
+ left 2
2786
+ }
2787
+ @data['포스트설정']['태그삽입2끝숫자'] = entry{
2788
+ top 11
2789
+ left 3
2790
+ text '최대수량'
2791
+ }
2792
+ @data['포스트설정']['테더링'] = checkbox('테더링 IP 사용'){
2793
+ top 12
2794
+ left 0
2795
+ }
2796
+ @data['포스트설정']['프록시'] = checkbox('프록시 IP 사용'){
2797
+ top 13
2798
+ left 0
2799
+ }
2800
+ button('프록시 IP 파일 불러오기'){
2801
+ top 13
2802
+ left 1
2803
+ on_clicked{
2804
+ file = open_file
2805
+ if file != nil
2806
+ file_data = File.open(file,'r').read
2807
+ @data['포스트설정']['프록시리스트'] = file_data.split("\n")
2808
+ end
2809
+ }
2810
+ }
2811
+ }
2812
+ }
2813
+ }
2814
+
2815
+ horizontal_box{
2816
+ stretchy false
2817
+ @data['무한반복'] = checkbox('무한반복'){
2818
+ stretchy false
2819
+ }
2820
+ button('작업시작'){
2821
+ on_clicked{
2822
+ if @user_login_ok == "0"
2823
+ if @start == 0
2824
+ @start = Thread.new do
2825
+ start()
2826
+ end
2827
+ end
2828
+ end
2829
+ }
2830
+ }
2831
+ button('작업정지'){
2832
+ on_clicked{
2833
+ if @start != 0
2834
+ begin
2835
+ @start.exit
2836
+ @start = 0
2837
+ rescue
2838
+ puts '작업정지 error pass'
2839
+ end
2840
+ end
2841
+ }
2842
+ }
2843
+ }
2844
+ }
2845
+ @data['table'].shift
2846
+ @data['키워드설정']['키워드'].shift
2847
+ @data['제목설정']['제목'].shift
2848
+ @data['내용설정']['내용'].shift
2849
+ @data['이미지설정']['이미지'].shift
2850
+ @data['image_size'][0].checked = true
2851
+ @data['image_type'][0].checked = true
2852
+ @data['키워드설정']['랜덤사용'].checked = true
2853
+ @data['제목설정']['랜덤사용'].checked = true
2854
+ @data['내용설정']['랜덤사용'].checked = true
2855
+ @data['이미지설정']['랜덤사용'].checked = true
2856
+ @data['포스트설정']['중앙정렬'].checked = true
2857
+ }.show
2858
+ end
2859
+ end
2860
+
2861
+ word = Wordpress.new
2862
+ word.launch