Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/flow-flo.../libs/flowflow/core/src/db
File: LADBManager.php
], http_build_query(['action' => 'get_subscription', 'token' => $token]));
[500] Fix | Delete
[501] Fix | Delete
if ($response->code == 200 && !empty($response->raw_body) && is_object($response->body)) {
[502] Fix | Delete
$subscription = json_encode($response->body);
[503] Fix | Delete
if (JSON_ERROR_NONE == json_last_error()){
[504] Fix | Delete
echo $subscription;
[505] Fix | Delete
}
[506] Fix | Delete
else {
[507] Fix | Delete
error_log($response->raw_body);
[508] Fix | Delete
}
[509] Fix | Delete
}
[510] Fix | Delete
else if ($this->isExpiredToken($response)){
[511] Fix | Delete
$this->get_boosts();
[512] Fix | Delete
}
[513] Fix | Delete
else {
[514] Fix | Delete
error_log($response->raw_body);
[515] Fix | Delete
}
[516] Fix | Delete
}
[517] Fix | Delete
die;
[518] Fix | Delete
}
[519] Fix | Delete
[520] Fix | Delete
/**
[521] Fix | Delete
* @throws Exception
[522] Fix | Delete
*/
[523] Fix | Delete
public function paymentSuccess(){
[524] Fix | Delete
$email = $_REQUEST['email'];
[525] Fix | Delete
$checkout_id = $_REQUEST['checkout_id'];
[526] Fix | Delete
$this->setOption( 'boosts_email', $email);
[527] Fix | Delete
$this->setOption( 'boosts_checkout_id', $checkout_id);
[528] Fix | Delete
$this->deleteOption('boosts_token');
[529] Fix | Delete
$this->deleteOption('boosts_subscription');
[530] Fix | Delete
[531] Fix | Delete
$domain = $_SERVER['HTTP_HOST'];
[532] Fix | Delete
$url = FF_BOOST_SERVER . 'registration?shop=' . $domain;
[533] Fix | Delete
[534] Fix | Delete
$data = [
[535] Fix | Delete
'action' => 'domain_registration',
[536] Fix | Delete
'email' => $email,
[537] Fix | Delete
'checkout_id' => $checkout_id,
[538] Fix | Delete
'options' => $this->getOption('options', false, false, true),
[539] Fix | Delete
'fb_auth_options' => $this->getOption('fb_auth_options', false, false, true),
[540] Fix | Delete
'url' => get_site_url()
[541] Fix | Delete
];
[542] Fix | Delete
global $wp_locale;
[543] Fix | Delete
$data['wp_locale'] = json_encode($wp_locale);
[544] Fix | Delete
$data['wp_timezone_string'] = get_option( 'timezone_string' );
[545] Fix | Delete
$data['wp_date_format'] = get_option( 'date_format' );
[546] Fix | Delete
$data['wp_time_format'] = get_option( 'time_format' );
[547] Fix | Delete
if (false != ($la_facebook_access_token = get_option('la_facebook_access_token', false))){
[548] Fix | Delete
$data['la_facebook_access_token'] = $la_facebook_access_token;
[549] Fix | Delete
}
[550] Fix | Delete
if (false != ($la_facebook_access_token_expires = get_option('la_facebook_access_token_expires', false))) {
[551] Fix | Delete
$data['la_facebook_access_token_expires'] = $la_facebook_access_token_expires;
[552] Fix | Delete
}
[553] Fix | Delete
Request::jsonOpts(true);
[554] Fix | Delete
Request::timeout(120);
[555] Fix | Delete
$response = Request::post($url, [
[556] Fix | Delete
'Content-Type: application/x-www-form-urlencoded'
[557] Fix | Delete
], http_build_query($data));
[558] Fix | Delete
[559] Fix | Delete
if ($response->code != 200) {
[560] Fix | Delete
error_log($response->raw_body);
[561] Fix | Delete
$this->deleteOption('boosts_email');
[562] Fix | Delete
$this->deleteOption('boosts_checkout_id');
[563] Fix | Delete
if ($response->code == 403 && isset($response->body['error']) && $response->body['error'] == 'Exceeded the limit on the number of domains') {
[564] Fix | Delete
header('Location: ' . admin_url('admin.php?page=flow-flow-admin&subscription=exceeded_domains'), true, 301);
[565] Fix | Delete
die();
[566] Fix | Delete
}
[567] Fix | Delete
}
[568] Fix | Delete
[569] Fix | Delete
header('Location: ' . admin_url('admin.php?page=flow-flow-admin&subscription=1'), true, 301);
[570] Fix | Delete
die();
[571] Fix | Delete
}
[572] Fix | Delete
[573] Fix | Delete
/**
[574] Fix | Delete
* @throws Exception
[575] Fix | Delete
*/
[576] Fix | Delete
public function upgradeSubscription() {
[577] Fix | Delete
if (null != ($token = $this->getToken())){
[578] Fix | Delete
$plan_id = $_REQUEST['plan_id'];
[579] Fix | Delete
$response = Request::post(FF_BOOST_SERVER . 'flow-flow/ff', [
[580] Fix | Delete
'Content-Type: application/x-www-form-urlencoded'
[581] Fix | Delete
], http_build_query(['action' => 'upgrade_subscription', 'token' => $token, 'plan_id' => $plan_id]));
[582] Fix | Delete
[583] Fix | Delete
if ($response->code == 200) {
[584] Fix | Delete
$response->body = (array)$response->body;
[585] Fix | Delete
if ($response->body['success']){
[586] Fix | Delete
header('Location: ' . admin_url('admin.php?page=flow-flow-admin'), true, 301);
[587] Fix | Delete
die;
[588] Fix | Delete
}
[589] Fix | Delete
}
[590] Fix | Delete
else if ($this->isExpiredToken($response)){
[591] Fix | Delete
$this->upgradeSubscription();
[592] Fix | Delete
}
[593] Fix | Delete
else {
[594] Fix | Delete
error_log($response->raw_body);
[595] Fix | Delete
}
[596] Fix | Delete
}
[597] Fix | Delete
error_log('FLOW-FLOW DEBUG: no subscription token' );
[598] Fix | Delete
http_response_code(500);
[599] Fix | Delete
die;
[600] Fix | Delete
}
[601] Fix | Delete
[602] Fix | Delete
/**
[603] Fix | Delete
* @throws Exception
[604] Fix | Delete
*/
[605] Fix | Delete
public function cancelSubscription() {
[606] Fix | Delete
if (null != ($token = $this->getToken())){
[607] Fix | Delete
$response = Request::post(FF_BOOST_SERVER . 'flow-flow/ff', [
[608] Fix | Delete
'Content-Type: application/x-www-form-urlencoded'
[609] Fix | Delete
], http_build_query(['action' => 'cancel_subscription', 'token' => $token]));
[610] Fix | Delete
[611] Fix | Delete
if ($response->code == 200) {
[612] Fix | Delete
$response->body = (array)$response->body;
[613] Fix | Delete
if ($response->body['success']){
[614] Fix | Delete
$this->deleteOption('boosts_email');
[615] Fix | Delete
$this->deleteOption('boosts_token');
[616] Fix | Delete
$this->deleteOption('boosts_checkout_id');
[617] Fix | Delete
$this->deleteOption('boosts_subscription');
[618] Fix | Delete
$this->deleteBoostedFeeds();
[619] Fix | Delete
header('Location: ' . admin_url('admin.php?page=flow-flow-admin'), true, 301);
[620] Fix | Delete
die;
[621] Fix | Delete
}
[622] Fix | Delete
}
[623] Fix | Delete
else if ($this->isExpiredToken($response)){
[624] Fix | Delete
$this->cancelSubscription();
[625] Fix | Delete
}
[626] Fix | Delete
else {
[627] Fix | Delete
error_log($response->raw_body);
[628] Fix | Delete
}
[629] Fix | Delete
}
[630] Fix | Delete
error_log('FLOW-FLOW DEBUG: no subscription token' );
[631] Fix | Delete
http_response_code(500);
[632] Fix | Delete
die;
[633] Fix | Delete
}
[634] Fix | Delete
[635] Fix | Delete
/**
[636] Fix | Delete
* @throws Exception
[637] Fix | Delete
*/
[638] Fix | Delete
public function clearSubscriptionCache() {
[639] Fix | Delete
if (isset($_REQUEST['email'])){
[640] Fix | Delete
$email = $_REQUEST['email'];
[641] Fix | Delete
$this->setOption( 'boosts_email', $email);
[642] Fix | Delete
}
[643] Fix | Delete
if (isset($_REQUEST['checkout_id'])){
[644] Fix | Delete
$checkout_id = $_REQUEST['checkout_id'];
[645] Fix | Delete
$this->setOption( 'boosts_checkout_id', $checkout_id);
[646] Fix | Delete
}
[647] Fix | Delete
$this->deleteOption('boosts_token');
[648] Fix | Delete
$this->deleteOption('boosts_subscription');
[649] Fix | Delete
die;
[650] Fix | Delete
}
[651] Fix | Delete
[652] Fix | Delete
public final function email_notification(){
[653] Fix | Delete
$admin_email = get_option('admin_email');
[654] Fix | Delete
if (!empty($admin_email)){
[655] Fix | Delete
$conn = $this->conn();
[656] Fix | Delete
$disabled_feeds = $conn->getAll('SELECT * FROM ?n WHERE enabled = 1 AND system_enabled = 0 AND send_email = 0', $this->cache_table_name);
[657] Fix | Delete
if (!empty($disabled_feeds)){
[658] Fix | Delete
ob_start();
[659] Fix | Delete
/** @noinspection PhpIncludeInspection */
[660] Fix | Delete
include($this->context['root'] . 'views/email.php');
[661] Fix | Delete
$message = ob_get_clean();
[662] Fix | Delete
[663] Fix | Delete
$headers = [];
[664] Fix | Delete
$headers[] = 'MIME-Version: 1.0';
[665] Fix | Delete
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
[666] Fix | Delete
$headers[] = 'X-Mailer: PHP/' . phpversion();
[667] Fix | Delete
// $headers[] = 'To: ' . $admin_email;
[668] Fix | Delete
$headers[] = 'From: Social Stream Apps <' . $admin_email . '>';
[669] Fix | Delete
$blog_name = htmlspecialchars_decode(get_bloginfo('name'));
[670] Fix | Delete
[671] Fix | Delete
$success = mail($admin_email, "[Flow-Flow] Broken feeds detected on " . $blog_name, $message, implode("\r\n", $headers));
[672] Fix | Delete
if ($success) {
[673] Fix | Delete
try {
[674] Fix | Delete
$conn->beginTransaction();
[675] Fix | Delete
foreach ( $disabled_feeds as $feed ) {
[676] Fix | Delete
$success = $this->saveSource($feed['feed_id'], [ 'send_email' => 1 ] );
[677] Fix | Delete
if (!$success){
[678] Fix | Delete
throw new Exception('Save source problem');
[679] Fix | Delete
}
[680] Fix | Delete
}
[681] Fix | Delete
$conn->commit();
[682] Fix | Delete
}
[683] Fix | Delete
catch ( Exception $e){
[684] Fix | Delete
error_log('email_notification');
[685] Fix | Delete
error_log($e->getMessage());
[686] Fix | Delete
error_log($e->getTraceAsString());
[687] Fix | Delete
$conn->rollbackAndClose();
[688] Fix | Delete
}
[689] Fix | Delete
}
[690] Fix | Delete
else {
[691] Fix | Delete
$errorMessage = error_get_last();
[692] Fix | Delete
error_log($errorMessage['message']);
[693] Fix | Delete
}
[694] Fix | Delete
}
[695] Fix | Delete
}
[696] Fix | Delete
}
[697] Fix | Delete
[698] Fix | Delete
public function modifySource($source, $changed_content = true, $with_errors = false){
[699] Fix | Delete
$errors = '';
[700] Fix | Delete
$id = $source['id'];
[701] Fix | Delete
$enabled = $source['enabled'];
[702] Fix | Delete
$cache_lifetime = $source['cache_lifetime'];
[703] Fix | Delete
$status = isset($source['status']) ? intval($source['status']) : 0;
[704] Fix | Delete
$boosted = $source['boosted'];
[705] Fix | Delete
unset($source['id']);
[706] Fix | Delete
unset($source['enabled']);
[707] Fix | Delete
unset($source['last_update']);
[708] Fix | Delete
unset($source['cache_lifetime']);
[709] Fix | Delete
unset($source['boosted']);
[710] Fix | Delete
if ($with_errors && isset($source['errors'])){
[711] Fix | Delete
$errors = serialize($source['errors']);
[712] Fix | Delete
}
[713] Fix | Delete
if (isset($source['errors'])) unset($source['errors']);
[714] Fix | Delete
if (isset($source['status'])) unset($source['status']);
[715] Fix | Delete
if (isset($source['system_enabled'])) unset($source['system_enabled']);
[716] Fix | Delete
[717] Fix | Delete
$in = [
[718] Fix | Delete
'settings' => serialize((object)$source),
[719] Fix | Delete
'enabled' => (int)LASettingsUtils::YepNope2ClassicStyle($enabled, true),
[720] Fix | Delete
'system_enabled' => (int)LASettingsUtils::YepNope2ClassicStyle($enabled, true),
[721] Fix | Delete
'last_update' => 0,
[722] Fix | Delete
'changed_time' => time(),
[723] Fix | Delete
'cache_lifetime' => $cache_lifetime,
[724] Fix | Delete
'status' => $status,
[725] Fix | Delete
'boosted' => $boosted
[726] Fix | Delete
];
[727] Fix | Delete
$up = [
[728] Fix | Delete
'settings' => serialize((object)$source),
[729] Fix | Delete
'enabled' => (int)LASettingsUtils::YepNope2ClassicStyle($enabled, true),
[730] Fix | Delete
'system_enabled' => (int)LASettingsUtils::YepNope2ClassicStyle($enabled, true),
[731] Fix | Delete
'cache_lifetime' => $cache_lifetime,
[732] Fix | Delete
'boosted' => $boosted
[733] Fix | Delete
];
[734] Fix | Delete
if ($changed_content) $up['last_update'] = '0';
[735] Fix | Delete
if ($with_errors && !empty($errors)) $up['errors'] = $errors;
[736] Fix | Delete
$conn = $this->conn();
[737] Fix | Delete
try {
[738] Fix | Delete
if ( false === $conn->query( 'INSERT INTO ?n SET `feed_id`=?s, ?u ON DUPLICATE KEY UPDATE ?u',
[739] Fix | Delete
$this->cache_table_name, $id, $in, $up ) ) {
[740] Fix | Delete
throw new Exception();
[741] Fix | Delete
}
[742] Fix | Delete
$conn->commit();
[743] Fix | Delete
}
[744] Fix | Delete
catch ( Exception $e){
[745] Fix | Delete
$conn->rollback();
[746] Fix | Delete
}
[747] Fix | Delete
}
[748] Fix | Delete
[749] Fix | Delete
private function changedContent( $source, $old ) {
[750] Fix | Delete
foreach ( $source as $key => $value ) {
[751] Fix | Delete
$old_value = $old[$key];
[752] Fix | Delete
if ($key == 'status' || $key == 'enabled' || $key == 'posts' || $key == 'errors' || $key == 'last_update' ||
[753] Fix | Delete
$key == 'cache_lifetime' || $key == 'mod' || $key == 'posts') continue;
[754] Fix | Delete
if ($old_value !== $value) {
[755] Fix | Delete
return true;
[756] Fix | Delete
}
[757] Fix | Delete
}
[758] Fix | Delete
return false;
[759] Fix | Delete
}
[760] Fix | Delete
[761] Fix | Delete
public function getGeneralSettings(){
[762] Fix | Delete
return new LAGeneralSettings($this->getOption('options', true), $this->getOption('fb_auth_options', true));
[763] Fix | Delete
}
[764] Fix | Delete
[765] Fix | Delete
[766] Fix | Delete
public function getOption( $optionName, $serialized = false, $lock_row = false, $without_cache = false ) {
[767] Fix | Delete
$options = LADB::getOption($this->conn(), $this->option_table_name, $this->plugin_slug_down . '_' . $optionName, $serialized, $lock_row, $without_cache);
[768] Fix | Delete
if ($optionName == 'options' && is_array($options)) {
[769] Fix | Delete
$options['general-uninstall'] = get_option($this->plugin_slug_down . '_general_uninstall', LASettingsUtils::NOPE);
[770] Fix | Delete
}
[771] Fix | Delete
return $options;
[772] Fix | Delete
}
[773] Fix | Delete
[774] Fix | Delete
/**
[775] Fix | Delete
* @param $optionName
[776] Fix | Delete
* @param $optionValue
[777] Fix | Delete
* @param false $serialized
[778] Fix | Delete
* @param bool $cached
[779] Fix | Delete
*
[780] Fix | Delete
* @throws Exception
[781] Fix | Delete
*/
[782] Fix | Delete
public function setOption($optionName, $optionValue, $serialized = false, $cached = true){
[783] Fix | Delete
LADB::setOption($this->conn(), $this->option_table_name, $this->plugin_slug_down . '_' . $optionName, $optionValue, $serialized, $cached);
[784] Fix | Delete
}
[785] Fix | Delete
[786] Fix | Delete
/**
[787] Fix | Delete
* @param $optionName
[788] Fix | Delete
*
[789] Fix | Delete
* @throws Exception
[790] Fix | Delete
*/
[791] Fix | Delete
public function deleteOption($optionName){
[792] Fix | Delete
LADB::deleteOption($this->conn(), $this->option_table_name, $this->plugin_slug_down . '_' . $optionName);
[793] Fix | Delete
}
[794] Fix | Delete
[795] Fix | Delete
/**
[796] Fix | Delete
* @return array
[797] Fix | Delete
* @throws Exception
[798] Fix | Delete
*/
[799] Fix | Delete
public function streams(){
[800] Fix | Delete
if ($this->init) return $this->streams;
[801] Fix | Delete
throw new Exception('Don`t init data manager');
[802] Fix | Delete
}
[803] Fix | Delete
[804] Fix | Delete
public function countFeeds(){
[805] Fix | Delete
return LADB::countFeeds($this->conn(), $this->cache_table_name);
[806] Fix | Delete
}
[807] Fix | Delete
[808] Fix | Delete
public function getStream($streamId){
[809] Fix | Delete
return $this->streams[$streamId];
[810] Fix | Delete
}
[811] Fix | Delete
[812] Fix | Delete
public function delete_stream(){
[813] Fix | Delete
[814] Fix | Delete
if (FF_USE_WP) {
[815] Fix | Delete
if (!current_user_can('manage_options') || !check_ajax_referer( 'flow_flow_nonce', 'security', false ) ) {
[816] Fix | Delete
die( json_encode( [ 'error' => 'not_allowed' ] ) );
[817] Fix | Delete
}
[818] Fix | Delete
}
[819] Fix | Delete
[820] Fix | Delete
$conn = $this->conn();
[821] Fix | Delete
try {
[822] Fix | Delete
$conn->beginTransaction();
[823] Fix | Delete
$id = $_POST['stream-id'];
[824] Fix | Delete
LADB::deleteStream($conn, $this->streams_table_name, $this->streams_sources_table_name, $id);
[825] Fix | Delete
do_action('ff_after_delete_stream', $id);
[826] Fix | Delete
$conn->commit();
[827] Fix | Delete
[828] Fix | Delete
$this->proxyRequest($_POST);
[829] Fix | Delete
} catch (Exception $e){
[830] Fix | Delete
error_log($e->getMessage());
[831] Fix | Delete
error_log($e->getTraceAsString());
[832] Fix | Delete
$conn->rollbackAndClose();
[833] Fix | Delete
die(false);
[834] Fix | Delete
}
[835] Fix | Delete
wp_send_json([], 200);
[836] Fix | Delete
}
[837] Fix | Delete
[838] Fix | Delete
public function canCreateCssFolder(){
[839] Fix | Delete
$dir = WP_CONTENT_DIR . '/resources/' . $this->context['slug'] . '/css';
[840] Fix | Delete
if(!file_exists($dir)){
[841] Fix | Delete
return mkdir($dir, 0777, true);
[842] Fix | Delete
}
[843] Fix | Delete
return true;
[844] Fix | Delete
}
[845] Fix | Delete
[846] Fix | Delete
public function generateCss($stream){
[847] Fix | Delete
$dir = WP_CONTENT_DIR . '/resources/' . $this->context['slug'] . '/css';
[848] Fix | Delete
if(!file_exists($dir)){
[849] Fix | Delete
mkdir($dir, 0777, true);
[850] Fix | Delete
}
[851] Fix | Delete
[852] Fix | Delete
$filename = $dir . "/stream-id" . $stream->id . ".css";
[853] Fix | Delete
if (!is_main_site()){
[854] Fix | Delete
$filename = $dir . '/stream-id' . $stream->id . '-'. get_current_blog_id() . '.css';
[855] Fix | Delete
}
[856] Fix | Delete
ob_start();
[857] Fix | Delete
/** @noinspection PhpIncludeInspection */
[858] Fix | Delete
include($this->context['root'] . 'views/stream-template-css.php');
[859] Fix | Delete
$output = ob_get_clean();
[860] Fix | Delete
$a = fopen($filename, 'w');
[861] Fix | Delete
fwrite($a, $output);
[862] Fix | Delete
fclose($a);
[863] Fix | Delete
chmod($filename, 0644);
[864] Fix | Delete
}
[865] Fix | Delete
[866] Fix | Delete
public function clone_stream(){
[867] Fix | Delete
[868] Fix | Delete
if (FF_USE_WP) {
[869] Fix | Delete
if (!current_user_can('manage_options') || !check_ajax_referer( 'flow_flow_nonce', 'security', false ) ) {
[870] Fix | Delete
die( json_encode( [ 'error' => 'not_allowed' ] ) );
[871] Fix | Delete
}
[872] Fix | Delete
}
[873] Fix | Delete
[874] Fix | Delete
$stream = $_REQUEST['stream'];
[875] Fix | Delete
[876] Fix | Delete
// cleaning if error was saved in database stream model, can be removed in future, now it's needed for affected users
[877] Fix | Delete
if ( isset( $stream['error'] ) ) unset( $stream['error'] );
[878] Fix | Delete
[879] Fix | Delete
$stream = (object)$stream;
[880] Fix | Delete
$conn = $this->conn();
[881] Fix | Delete
try{
[882] Fix | Delete
$conn->beginTransaction();
[883] Fix | Delete
if (false !== ($count = LADB::maxIdOfStreams( $conn, $this->streams_table_name))) {
[884] Fix | Delete
$newId = (string) ($count + 1);
[885] Fix | Delete
$stream->id = $newId;
[886] Fix | Delete
$stream->name = "{$stream->name} copy";
[887] Fix | Delete
$stream->last_changes = time();
[888] Fix | Delete
LADB::setStream($conn, $this->streams_table_name, $this->streams_sources_table_name, $newId, $stream);
[889] Fix | Delete
$this->generateCss($stream);
[890] Fix | Delete
[891] Fix | Delete
$this->proxyRequest($_POST);
[892] Fix | Delete
[893] Fix | Delete
$conn->commit();
[894] Fix | Delete
echo json_encode($stream);
[895] Fix | Delete
}
[896] Fix | Delete
else {
[897] Fix | Delete
throw new Exception('Can`t get a new id for the clone stream');
[898] Fix | Delete
}
[899] Fix | Delete
}catch (Exception $e){
[900] Fix | Delete
$conn->rollbackAndClose();
[901] Fix | Delete
error_log('clone_stream error:');
[902] Fix | Delete
error_log($e->getMessage());
[903] Fix | Delete
error_log($e->getTraceAsString());
[904] Fix | Delete
}
[905] Fix | Delete
$conn->close();
[906] Fix | Delete
die();
[907] Fix | Delete
}
[908] Fix | Delete
[909] Fix | Delete
/**
[910] Fix | Delete
* @param $settings
[911] Fix | Delete
*
[912] Fix | Delete
* @return mixed
[913] Fix | Delete
* @throws Exception
[914] Fix | Delete
*/
[915] Fix | Delete
protected function saveGeneralSettings($settings){
[916] Fix | Delete
if (isset($settings['flow_flow_options']['general-uninstall'])){
[917] Fix | Delete
$general_uninstall_option_name = $this->plugin_slug_down . '_general_uninstall';
[918] Fix | Delete
$value = ($settings['flow_flow_options']['general-uninstall'] === LASettingsUtils::YEP) ? LASettingsUtils::YEP : LASettingsUtils::NOPE;
[919] Fix | Delete
if ( get_option( $general_uninstall_option_name) !== false ) {
[920] Fix | Delete
update_option( $general_uninstall_option_name, $value );
[921] Fix | Delete
}
[922] Fix | Delete
else {
[923] Fix | Delete
add_option( $general_uninstall_option_name, $value, '', 'no' );
[924] Fix | Delete
}
[925] Fix | Delete
unset($settings['flow_flow_options']['general-uninstall']);
[926] Fix | Delete
}
[927] Fix | Delete
[928] Fix | Delete
$this->setOption('options', $settings['flow_flow_options'], true);
[929] Fix | Delete
return $settings;
[930] Fix | Delete
}
[931] Fix | Delete
[932] Fix | Delete
protected abstract function customizeResponse(&$response);
[933] Fix | Delete
[934] Fix | Delete
protected abstract function clean_cache($options);
[935] Fix | Delete
[936] Fix | Delete
protected abstract function refreshCache($streamId, $force_load_cache = false);
[937] Fix | Delete
[938] Fix | Delete
protected function refreshCache4Source($id, $force_load_cache = false, $boosted = false){
[939] Fix | Delete
if (!$boosted){
[940] Fix | Delete
$this->saveSource($id, ['status' => '2']);
[941] Fix | Delete
[942] Fix | Delete
$useIpv4 = $this->getGeneralSettings()->useIPv4();
[943] Fix | Delete
$use = $this->getGeneralSettings()->useCurlFollowLocation();
[944] Fix | Delete
$url = $this->getLoadCacheUrl( $id, $force_load_cache );
[945] Fix | Delete
LASettingsUtils::get( $url, 1, false, false, $use, $useIpv4);
[946] Fix | Delete
}
[947] Fix | Delete
}
[948] Fix | Delete
[949] Fix | Delete
/**
[950] Fix | Delete
* @return array|null
[951] Fix | Delete
* @throws Exception
[952] Fix | Delete
*/
[953] Fix | Delete
public function streamsWithStatus(){
[954] Fix | Delete
if (false !== ($result = self::streams())){
[955] Fix | Delete
return $result;
[956] Fix | Delete
}
[957] Fix | Delete
return [];
[958] Fix | Delete
}
[959] Fix | Delete
[960] Fix | Delete
/**
[961] Fix | Delete
* @return array | null
[962] Fix | Delete
* @throws Exception
[963] Fix | Delete
*/
[964] Fix | Delete
public function sources(){
[965] Fix | Delete
if ($this->init) return $this->sources;
[966] Fix | Delete
throw new Exception('Don`t init data manager');
[967] Fix | Delete
}
[968] Fix | Delete
[969] Fix | Delete
//TODO: refactor posts table does not have field with name stream_id
[970] Fix | Delete
public function clean(array $streams = null){
[971] Fix | Delete
$conn = $this->conn();
[972] Fix | Delete
$partOfSql = $streams == null ? '' : $conn->parse('WHERE `stream_id` IN (?a)', $streams);
[973] Fix | Delete
try{
[974] Fix | Delete
if ($conn->beginTransaction()){
[975] Fix | Delete
$conn->query('DELETE FROM ?n ?p', $this->posts_table_name, $partOfSql);
[976] Fix | Delete
$conn->query('DELETE FROM ?n', $this->image_cache_table_name);
[977] Fix | Delete
$conn->commit();
[978] Fix | Delete
}
[979] Fix | Delete
$conn->rollback();
[980] Fix | Delete
}catch ( Exception $e){
[981] Fix | Delete
$conn->rollbackAndClose();
[982] Fix | Delete
}
[983] Fix | Delete
}
[984] Fix | Delete
[985] Fix | Delete
[986] Fix | Delete
public function deleteFeed($feedId){
[987] Fix | Delete
$conn = $this->conn();
[988] Fix | Delete
try{
[989] Fix | Delete
if ($conn->beginTransaction()){
[990] Fix | Delete
$partOfSql = $conn->parse('WHERE `feed_id` = ?s', $feedId);
[991] Fix | Delete
$conn->query('DELETE FROM ?n ?p', $this->posts_table_name, $partOfSql);
[992] Fix | Delete
$conn->query('DELETE FROM ?n ?p', $this->post_media_table_name, $partOfSql);
[993] Fix | Delete
$conn->query('DELETE FROM ?n ?p', $this->cache_table_name, $partOfSql);
[994] Fix | Delete
$conn->query('DELETE FROM ?n ?p', $this->streams_sources_table_name, $partOfSql);
[995] Fix | Delete
$conn->commit();
[996] Fix | Delete
}
[997] Fix | Delete
$conn->rollback();
[998] Fix | Delete
}catch ( Exception $e){
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function