@@ 59-116 (lines=58) @@ | ||
56 | * |
|
57 | * @return int |
|
58 | */ |
|
59 | function xnewsletter_plugin_getdata_rmbulletin($cat_id, $action_after_read, $limitcheck, $skipcatsubscrexist) |
|
60 | { |
|
61 | global $xoopsDB; |
|
62 | $helper = Xnewsletter\Helper::getInstance(); |
|
63 | ||
64 | //$table_import = $xoopsDB->prefix('xnewsletter_import'); |
|
65 | $import_status = 0 == $action_after_read ? true : false; |
|
66 | $i = 0; |
|
67 | $j = 0; |
|
68 | ||
69 | $sql = 'SELECT `email`'; |
|
70 | $sql .= ' FROM ' . $xoopsDB->prefix('rmb_users'); |
|
71 | if (!$result_users = $xoopsDB->query($sql)) { |
|
72 | die('MySQL-Error: ' . $GLOBALS['xoopsDB']->error()); |
|
73 | } |
|
74 | while (false !== ($lineArray = $xoopsDB->fetchBoth($result_users))) { |
|
75 | ++$i; |
|
76 | $email = $lineArray[0]; |
|
77 | $sex = ''; |
|
78 | $firstname = ''; |
|
79 | $lastname = ''; |
|
80 | ||
81 | $subscr_id = xnewsletter_pluginCheckEmail($email); |
|
82 | $catsubscr_id = xnewsletter_pluginCheckCatSubscr($subscr_id, $cat_id); |
|
83 | ||
84 | if (1 == $skipcatsubscrexist && $catsubscr_id > 0) { |
|
85 | //skip existing subscriptions |
|
86 | } else { |
|
87 | $currcatid = $catsubscr_id > 0 ? 0 : $cat_id; |
|
88 | $importObj = $helper->getHandler('Import')->create(); |
|
89 | $importObj->setVar('import_email', $email); |
|
90 | $importObj->setVar('import_sex', $sex); |
|
91 | $importObj->setVar('import_firstname', $firstname); |
|
92 | $importObj->setVar('import_lastname', $lastname); |
|
93 | $importObj->setVar('import_cat_id', $currcatid); |
|
94 | $importObj->setVar('import_subscr_id', $subscr_id); |
|
95 | $importObj->setVar('import_catsubscr_id', $catsubscr_id); |
|
96 | $importObj->setVar('import_status', $import_status); |
|
97 | if (!$helper->getHandler('Import')->insert($importObj)) { |
|
98 | echo $importObj->getHtmlErrors(); |
|
99 | exit(); |
|
100 | } |
|
101 | // $sql = "INSERT INTO {$table_import} (import_email, import_sex, import_firstname, import_lastname, import_cat_id, import_subscr_id, import_catsubscr_id, import_status)"; |
|
102 | // $sql .= " VALUES ('$email', '$sex', '$firstname', '$lastname', $currcatid, $subscr_id, $catsubscr_id, $import_status)"; |
|
103 | // $result_insert = $xoopsDB->query($sql) or die ("MySQL-Error: " . $GLOBALS['xoopsDB']->error()); |
|
104 | ++$j; |
|
105 | } |
|
106 | ++$i; |
|
107 | if (100000 == $j) { |
|
108 | break; |
|
109 | } //maximum number of processing to avoid cache overflow |
|
110 | if ($limitcheck > 0 && $j == $limitcheck) { |
|
111 | $import_status = false; |
|
112 | } |
|
113 | } |
|
114 | ||
115 | return $j; |
|
116 | } |
|
117 |
@@ 63-121 (lines=59) @@ | ||
60 | * |
|
61 | * @return int |
|
62 | */ |
|
63 | function xnewsletter_plugin_getdata_smartpartner($cat_id, $action_after_read, $limitcheck, $skipcatsubscrexist) |
|
64 | { |
|
65 | global $xoopsDB; |
|
66 | $helper = Xnewsletter\Helper::getInstance(); |
|
67 | ||
68 | //$table_import = $xoopsDB->prefix('xnewsletter_import'); |
|
69 | $import_status = 0 == $action_after_read ? true : false; |
|
70 | $i = 0; |
|
71 | $j = 0; |
|
72 | ||
73 | $sql = 'SELECT `contact_email`, `contact_name`'; |
|
74 | $sql .= ' FROM ' . $xoopsDB->prefix('smartpartner_partner'); |
|
75 | $sql .= " WHERE (`contact_email` is not null and not(`contact_email`=''))"; |
|
76 | if (!$result_users = $xoopsDB->query($sql)) { |
|
77 | die('MySQL-Error: ' . $GLOBALS['xoopsDB']->error()); |
|
78 | } |
|
79 | while (false !== ($lineArray = $xoopsDB->fetchBoth($result_users))) { |
|
80 | ++$i; |
|
81 | $email = $lineArray[0]; |
|
82 | $sex = ''; |
|
83 | $firstname = ''; |
|
84 | $lastname = $lineArray[1]; |
|
85 | ||
86 | $subscr_id = xnewsletter_pluginCheckEmail($email); |
|
87 | $catsubscr_id = xnewsletter_pluginCheckCatSubscr($subscr_id, $cat_id); |
|
88 | ||
89 | if (1 == $skipcatsubscrexist && $catsubscr_id > 0) { |
|
90 | //skip existing subscriptions |
|
91 | } else { |
|
92 | $currcatid = $catsubscr_id > 0 ? 0 : $cat_id; |
|
93 | $importObj = $helper->getHandler('Import')->create(); |
|
94 | $importObj->setVar('import_email', $email); |
|
95 | $importObj->setVar('import_sex', $sex); |
|
96 | $importObj->setVar('import_firstname', $firstname); |
|
97 | $importObj->setVar('import_lastname', $lastname); |
|
98 | $importObj->setVar('import_cat_id', $currcatid); |
|
99 | $importObj->setVar('import_subscr_id', $subscr_id); |
|
100 | $importObj->setVar('import_catsubscr_id', $catsubscr_id); |
|
101 | $importObj->setVar('import_status', $import_status); |
|
102 | if (!$helper->getHandler('Import')->insert($importObj)) { |
|
103 | echo $importObj->getHtmlErrors(); |
|
104 | exit(); |
|
105 | } |
|
106 | // $sql = "INSERT INTO {$table_import} (import_email, import_sex, import_firstname, import_lastname, import_cat_id, import_subscr_id, import_catsubscr_id, import_status)"; |
|
107 | // $sql .= " VALUES ('$email', '$sex', '$firstname', '$lastname', $currcatid, $subscr_id, $catsubscr_id, $import_status)"; |
|
108 | // $result_insert = $xoopsDB->query($sql) || die ("MySQL-Error: " . $GLOBALS['xoopsDB']->error()); |
|
109 | ++$j; |
|
110 | } |
|
111 | ++$i; |
|
112 | if (100000 == $j) { |
|
113 | break; |
|
114 | } //maximum number of processing to avoid cache overflow |
|
115 | if ($limitcheck > 0 && $j == $limitcheck) { |
|
116 | $import_status = false; |
|
117 | } |
|
118 | } |
|
119 | ||
120 | return $j; |
|
121 | } |
|
122 |
@@ 63-121 (lines=59) @@ | ||
60 | * |
|
61 | * @return int |
|
62 | */ |
|
63 | function xnewsletter_plugin_getdata_subscribers($cat_id, $action_after_read, $limitcheck, $skipcatsubscrexist) |
|
64 | { |
|
65 | global $xoopsDB; |
|
66 | $helper = Xnewsletter\Helper::getInstance(); |
|
67 | ||
68 | //$table_import = $xoopsDB->prefix('xnewsletter_import'); |
|
69 | $import_status = 0 == $action_after_read ? true : false; |
|
70 | $i = 0; |
|
71 | $j = 0; |
|
72 | ||
73 | $sql = 'SELECT `user_email`, `user_name`'; |
|
74 | $sql .= ' FROM ' . $xoopsDB->prefix('subscribers_user'); |
|
75 | $sql .= " WHERE (`user_email` is not null and not(`user_email`=''))"; |
|
76 | if (!$result_users = $xoopsDB->query($sql)) { |
|
77 | die('MySQL-Error: ' . $GLOBALS['xoopsDB']->error()); |
|
78 | } |
|
79 | while (false !== ($lineArray = $xoopsDB->fetchBoth($result_users))) { |
|
80 | ++$i; |
|
81 | $email = $lineArray[0]; |
|
82 | $sex = ''; |
|
83 | $firstname = ''; |
|
84 | $lastname = $lineArray[1]; |
|
85 | ||
86 | $subscr_id = xnewsletter_pluginCheckEmail($email); |
|
87 | $catsubscr_id = xnewsletter_pluginCheckCatSubscr($subscr_id, $cat_id); |
|
88 | ||
89 | if (1 == $skipcatsubscrexist && $catsubscr_id > 0) { |
|
90 | //skip existing subscriptions |
|
91 | } else { |
|
92 | $currcatid = $catsubscr_id > 0 ? 0 : $cat_id; |
|
93 | $importObj = $helper->getHandler('Import')->create(); |
|
94 | $importObj->setVar('import_email', $email); |
|
95 | $importObj->setVar('import_sex', $sex); |
|
96 | $importObj->setVar('import_firstname', $firstname); |
|
97 | $importObj->setVar('import_lastname', $lastname); |
|
98 | $importObj->setVar('import_cat_id', $currcatid); |
|
99 | $importObj->setVar('import_subscr_id', $subscr_id); |
|
100 | $importObj->setVar('import_catsubscr_id', $catsubscr_id); |
|
101 | $importObj->setVar('import_status', $import_status); |
|
102 | if (!$helper->getHandler('Import')->insert($importObj)) { |
|
103 | echo $importObj->getHtmlErrors(); |
|
104 | exit(); |
|
105 | } |
|
106 | // $sql = "INSERT INTO {$table_import} (import_email, import_sex, import_firstname, import_lastname, import_cat_id, import_subscr_id, import_catsubscr_id, import_status)"; |
|
107 | // $sql .= " VALUES ('$email', '$sex', '$firstname', '$lastname', $currcatid, $subscr_id, $catsubscr_id, $import_status)"; |
|
108 | // $result_insert = $xoopsDB->query($sql) or die ("MySQL-Error: " . $GLOBALS['xoopsDB']->error()); |
|
109 | ++$j; |
|
110 | } |
|
111 | ++$i; |
|
112 | if (100000 == $j) { |
|
113 | break; |
|
114 | } //maximum number of processing to avoid cache overflow |
|
115 | if ($limitcheck > 0 && $j == $limitcheck) { |
|
116 | $import_status = false; |
|
117 | } |
|
118 | } |
|
119 | ||
120 | return $j; |
|
121 | } |
|
122 |
@@ 63-120 (lines=58) @@ | ||
60 | * |
|
61 | * @return int |
|
62 | */ |
|
63 | function xnewsletter_plugin_getdata_weblinks($cat_id, $action_after_read, $limitcheck, $skipcatsubscrexist) |
|
64 | { |
|
65 | global $xoopsDB; |
|
66 | $helper = Xnewsletter\Helper::getInstance(); |
|
67 | ||
68 | //$table_import = $xoopsDB->prefix('xnewsletter_import'); |
|
69 | $import_status = 0 == $action_after_read ? true : false; |
|
70 | $i = 0; |
|
71 | $j = 0; |
|
72 | ||
73 | $sql = 'SELECT `mail`, `name`'; |
|
74 | $sql .= ' FROM ' . $xoopsDB->prefix('weblinks_link'); |
|
75 | if (!$result_users = $xoopsDB->query($sql)) { |
|
76 | die('MySQL-Error: ' . $GLOBALS['xoopsDB']->error()); |
|
77 | } |
|
78 | while (false !== ($lineArray = $xoopsDB->fetchBoth($result_users))) { |
|
79 | ++$i; |
|
80 | $email = $lineArray[0]; |
|
81 | $sex = ''; |
|
82 | $firstname = ''; |
|
83 | $lastname = $lineArray[1]; |
|
84 | ||
85 | $subscr_id = xnewsletter_pluginCheckEmail($email); |
|
86 | $catsubscr_id = xnewsletter_pluginCheckCatSubscr($subscr_id, $cat_id); |
|
87 | ||
88 | if (1 == $skipcatsubscrexist && $catsubscr_id > 0) { |
|
89 | //skip existing subscriptions |
|
90 | } else { |
|
91 | $currcatid = $catsubscr_id > 0 ? 0 : $cat_id; |
|
92 | $importObj = $helper->getHandler('Import')->create(); |
|
93 | $importObj->setVar('import_email', $email); |
|
94 | $importObj->setVar('import_sex', $sex); |
|
95 | $importObj->setVar('import_firstname', $firstname); |
|
96 | $importObj->setVar('import_lastname', $lastname); |
|
97 | $importObj->setVar('import_cat_id', $currcatid); |
|
98 | $importObj->setVar('import_subscr_id', $subscr_id); |
|
99 | $importObj->setVar('import_catsubscr_id', $catsubscr_id); |
|
100 | $importObj->setVar('import_status', $import_status); |
|
101 | if (!$helper->getHandler('Import')->insert($importObj)) { |
|
102 | echo $importObj->getHtmlErrors(); |
|
103 | exit(); |
|
104 | } |
|
105 | // $sql = "INSERT INTO {$table_import} (import_email, import_sex, import_firstname, import_lastname, import_cat_id, import_subscr_id, import_catsubscr_id, import_status)"; |
|
106 | // $sql .= " VALUES ('$email', '$sex', '$firstname', '$lastname', $currcatid, $subscr_id, $catsubscr_id, $import_status)"; |
|
107 | // $result_insert = $xoopsDB->query($sql) or die ("MySQL-Error: " . $GLOBALS['xoopsDB']->error()); |
|
108 | ++$j; |
|
109 | } |
|
110 | ++$i; |
|
111 | if (100000 == $j) { |
|
112 | break; |
|
113 | } //maximum number of processing to avoid cache overflow |
|
114 | if ($limitcheck > 0 && $j == $limitcheck) { |
|
115 | $import_status = false; |
|
116 | } |
|
117 | } |
|
118 | ||
119 | return $j; |
|
120 | } |
|
121 |