GIF89a=( õ' 7IAXKgNgYvYx\%wh…hŽth%ˆs%—x¨}9®Œ©€&©‰%¶†(¹–.¹5·œD¹&Çš)ÇŸ5ǘ;Í£*È¡&Õ²)ׯ7×µ<Ñ»4ï°3ø‘HÖ§KͯT÷¨Yÿšqÿ»qÿÔFØ !ù ' !ÿ NETSCAPE2.0 , =( þÀ“pH,È¤rÉl:ŸÐ¨tJ­Z¯Ø¬vËíz¿à°xL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~Ïïûÿ€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§gª«ªE¯°¨¬ª±²Œ¹º¹E¾­”´ÂB¶¯ §Åȸ»ÑD¾¿Á•ÄÅ®° ÝH¾ÒLÀÆDÙ«D¶BÝïðÀ¾DÑÑÔTÌÍíH òGö¨A RÎڐ |¥ ٭&ºìE8œ¹kGÔAÞpx­a¶­ã R2XB®åE8I€Õ6Xî:vT)äžþÀq¦è³¥ì仕F~%xñ  4#ZÔ‰O|-4Bs‘X:= QÉ œš lºÒyXJŠGȦ|s hÏíK–3l7·B|¥$'7Jީܪ‰‡àá”Dæn=Pƒ ¤Òëí‰`䌨ljóá¯Éüv>á–Á¼5 ½.69ûϸd«­ºÀûnlv©‹ªîf{¬ÜãPbŸ  l5‘ޝpß ´ ˜3aÅùäI«O’ý·‘áÞ‡˜¾Æ‚ÙÏiÇÿ‹Àƒ #öó)pâš Þ½ ‘Ý{ó)vmÞü%D~ 6f s}ŃƒDØW Eþ`‡þ À…L8xá†ç˜{)x`X/> Ì}mø‚–RØ‘*|`D=‚Ø_ ^ð5 !_…'aä“OÚ—7âcð`D”Cx`ÝÂ¥ä‹éY¹—F¼¤¥Š?¡Õ™ n@`} lď’ÄÉ@4>ñd œ à‘vÒxNÃ×™@žd=ˆgsžG±æ ´²æud &p8Qñ)ˆ«lXD©øÜéAžHìySun jª×k*D¤LH] †¦§C™Jä–´Xb~ʪwStŽ6K,°£qÁœ:9ت:¨þªl¨@¡`‚ûÚ ».Û¬¯t‹ÆSÉ[:°=Š‹„‘Nåû”Ìî{¿ÂA ‡Rà›ÀÙ6úë°Ÿð0Ä_ ½;ÃϱîÉì^ÇÛÇ#Ëë¼ôº!±Ä˜íUîÅÇ;0L1óÁµö«p% AÀºU̬ݵ¼á%霼€‡¯Á~`ÏG¯»À× ­²± =4ªnpð3¾¤³¯­ü¾¦îuÙuµÙ®|%2ÊIÿür¦#0·ÔJ``8È@S@5ê¢ ö×Þ^`8EÜ]ý.뜃Âç 7 ú ȉÞj œ½Dç zý¸iþœÑÙûÄë!ˆÞÀl§Ïw‹*DçI€nEX¯¬¼ &A¬Go¼QföõFç°¯;é¦÷îŽêJ°îúôF5¡ÌQ|îúöXªæ»TÁÏyñêï]ê² o óÎC=öõ›ÒÓPB@ D×½œä(>èCÂxŽ`±«Ÿ–JЀ»Û á¤±p+eE0`ëŽ`A Ú/NE€Ø†À9‚@¤à H½7”à‡%B‰`Àl*ƒó‘–‡8 2ñ%¸ —€:Ù1Á‰E¸àux%nP1ð!‘ðC)¾P81lÑɸF#ˆ€{´âé°ÈB„0>±û °b¡Š´±O‚3È–Ù()yRpbµ¨E.Z‘D8ÊH@% òŒx+%Ù˜Æcü »¸˜fõ¬b·d`Fê™8èXH"ÉÈ-±|1Ô6iI, 2““¬$+](A*jÐ QTÂo‰.ÛU슬Œã„Ž`¯SN¡–¶Äåyše¯ª’­¬‚´b¦Éož œ)åyâ@Ì®3 ÎtT̉°&Ø+žLÀf"Ø-|žçÔ>‡Ðv¦Ðžì\‚ Q1)Ž@Žh#aP72”ˆ™¨$‚ !ù " , =( …7IAXG]KgNgYvYxR"k\%w]'}hŽth%ˆg+ˆs%—r.—m3šx3˜x¨}9®€&©€+¨‡7§‰%¶†(¹–.¹œD¹&ǘ;Í•&ײ)×»4ïÌ6ò§KÍ þ@‘pH,È¤rÉl:ŸÐ¨tJ­Z¯Ø¬vËíz¿à°xL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~Ïïûÿ€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§g «¬ E ±± ¨­¶°ººE Á´”·®C¬²§Ç¶Œ»ÓDÃÕƷ¯Ê±H½ºM×ÁGÚ¬D¶BËÁ½î½DÓôTÏÛßîG»ôõC×CÌ l&âž:'òtU³6ɹ#·Ø)€'Ü.6±&ëÍÈ» K(8p0N?!æ2"ÛˆNIJX>R¼ÐO‚M '¡¨2¸*Ÿþ>#n↠å@‚<[:¡Iïf’ ¤TÚ˘CdbÜÙ“[«ŽEú5MBo¤×@€`@„€Êt W-3 ¶Ÿ¡BíêäjIÝ…Eò9[T…$íêﯧ„…•s»Óȳ¹€ÅÚdc®UUρ#±Ùïldj?´í¼²`\ŽÁðÞu|3'ÖŒ]ë6 ¶S#²‡˜FKLÈ *N E´‘áäŠ$˜›eÄYD„ºq«.è촁ƒs \-ÔjA 9²õ÷å- üúM[Âx(ís÷ì®x€|í¡Ù’p¦‚ ŽkÛTÇDpE@WÜ ²Ç]kŠ1¨ þ€·Yb ÓÁ‰l°*n0 ç™—žzBdОu¾7ĉBl€â‰-ºx~|UåU‰  h*Hœ|e"#"?vpÄiŠe6^ˆ„+qâŠm8 #VÇá ‘å–ÄV„œ|Аè•m"сœn|@›U¶ÆÎž—Špb¥G¨ED”€±Úê2FÌIç? >Éxå Œ± ¡¤„%‘žjŸ‘ꄯ<Ìaà9ijÐ2˜D¦È&›†Z`‚å]wþ¼Â:ç6àB¤7eFJ|õÒ§Õ,¨äàFÇ®cS·Ê¶+B°,‘Þ˜ºNûãØ>PADÌHD¹æž«ÄÀnÌ¥}­#Ë’ë QÀÉSÌÂÇ2ÌXÀ{æk²lQÁ2«ÊðÀ¯w|2Í h‹ÄÂG€,m¾¶ë3ÐÙ6-´ÅE¬L°ÆIij*K½ÀÇqï`DwVÍQXœÚÔpeœ±¬Ñ q˜§Tœ½µƒ°Œìu Â<¶aØ*At¯lmEØ ü ôÛN[P1ÔÛ¦­±$ÜÆ@`ùåDpy¶yXvCAyåB`ŽD¶ 0QwG#¯ æš[^Äþ $ÀÓÝǦ{„L™[±úKÄgÌ;ï£S~¹ìGX.ôgoT.»åˆ°ùŸûù¡?1zö¦Ÿž:ÅgÁ|ìL¹ „®£œŠ‚à0œ]PÁ^p F<"•ç?!,ñ‡N4—…PÄ Á„ö¨Û:Tè@hÀ‹%táÿ:ø-žI<`þ‹p I….)^ 40D#p@ƒj4–؀:²‰1Øâr˜¼F2oW¼#Z†;$Q q” ‘ ÂK¦ñNl#29 !’F@¥Bh·ᏀL!—XFóLH‘Kh¤.«hE&JòG¨¥<™WN!€ÑÙÚˆY„@†>Œž19J" 2,/ &.GXB%ÌRÈ9B6¹W]’î×ÔW¥’IÎ$ ñ‹ÓŒE8YÆ ¼³™ñA5“à®Q.aŸB€&Ø©³ JÁ—! ¦t)K%tœ-¦JF bòNMxLôþ)ÐR¸Ð™‘ èÝ6‘O!THÌ„HÛ ‰ !ù ) , =( …AXKgNgYvYxR"k\%wh…hŽh%ˆg+ˆs%—r.—x3˜x¨}9®€&©€+¨Œ,©‡7§‰%¶†(¹–.¹5·&Çš)ǘ;Í•&×£*Ȳ)ׯ7×»4ï°3øÌ6ò‘HÖ§KÍ»Hó¯T÷¨Yÿ»qÿÇhÿ þÀ”pH,È¤rÉl:ŸÐ¨tJ­Z¯Ø¬vËíz¿à°xL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~Ïïûÿ€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§g ª« E$±²¨ª­ · °²½$E$ÂÕ««D· Í ¿¦Ç¶¸ÌŒ¾³CÃÅÆ E ééH½MÛÂGâªD­ çBêêϾD²ÒaÀà€Š1r­ðÓ¤ ÔožzU!L˜C'¾yW½UGtäÇïÙllê0×àÂuGþ)AÀs[þ·xì ÁxO%ƒûX2ó—  P£n›R/¡ÑšHše+êDm?# —‘Ç£6¡8íJ¡ŸâDiäªM¥Ö„ôj“¬¹£5oQ7°- <‡ *´lãÓŒ2r/a!l)dÈ A™ÈE¢ôÔ͆…ð ;Ö˜c ¡%ß‚’Ùˆâ¸b½—pe~C"BíëÚHïeF2§æŠ8qb t_`urŠeü wÅu3êæPv§h•"ß`íÍxçLĹÜÖ3á  ~Öº“®›¸ÏMDfJÙ °„ÛµáWõ%§œ‚à©–‚X ÓØ)@®Ñ›Eþ´wëuÅSxb8y\mÖzœ¥§ZbºE—ÂLªÌw!y(>¡™wú=Ç|ÅÝs¢d €CÁW)HÜcC$€L Ä7„r.á\{)@ð` @ äXÈ$PD” `šaG:§æˆOˆ72EÐamn]ù"ŒcÊxÑŒ° &dR8`g«iÙŸLR!¦P …d’ä¡“¦ðÎTƒ¦ià|À _ ¥ Qi#¦Šg›Æ ›noMµ ›V ã£)p ç£ÎW…š=Âeªk§†j„ ´®1ß²sÉxéW«jšl|0¯B0Û, \jÛ´›6±¬¶C ÛíWþï|ëÙ‹¸ñzĸV {ì;Ýñn¼òVˆm³I¼³.Ðã¤PN¥ ²µ¼„µCã+¹ÍByî£Ñ¾HŸ›ëê 7ìYÆFTk¨SaoaY$Dµœìï¿Ã29RÈkt Çïfñ ÇÒ:ÀÐSp¹3ÇI¨â¥DZÄ ü9Ïýögñ½­uÔ*3)O‘˜Ö[_hv ,àî×Et Ÿé¶BH€ Õ[ü±64M@ÔSÌM7dÐl5-ÄÙU܍´©zߌ3Ô€3ž„ „ ¶ÛPô½5×g› êÚ˜kN„Ý…0Îj4€Ìë°“#{þÕ3S2çKÜ'ợlø¼Ú2K{° {Û¶?žm𸧠ËI¼nEò='êüóºè^üæÃ_Û=°óž‚ì#Oý¿Í'¡½áo..ÏYìnüñCœO±Áa¿¢Kô½o,üÄËbö²çºíï{ËC Ú— "”Ï{ËK ÍÒw„õ±Oz dÕ¨à:$ ƒô—«v»] A#ð «€¿šéz)Rx׿ˆ¥‚d``èw-îyÏf×K!ð€þ­Ð|ìPľ„=Ì`ý(f” 'Pa ¥ÐBJa%Ðâf§„%Š¡}FàáÝ×6>ÉäŠG"éŽè=ø!oа^FP¼Ø©Q„ÀCÙÁ`(Ž\ÄÝ® ©Â$<n@dÄ E#ììUÒI! ‚#lù‹`k¦ÐÇ'Rró’ZýNBÈMF Í[¤+‹ðɈ-áwj¨¥þ8¾rá ,VÂh„"|½œ=×G_¦Ñ™EØ 0i*%̲˜Æda0mV‚k¾)›;„&6 p>ÓjK “¦Ç# âDÂ:ûc?:R Ó¬fÞéI-Ì“•Ã<ä=™Ï7˜3œ¨˜c2ŒW ,ˆ”8(T™P‰F¡Jhç"‚ ; 403WebShell
403Webshell
Server IP : 172.67.177.218  /  Your IP : 216.73.216.195
Web Server : LiteSpeed
System : Linux premium229.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User : akhalid ( 749)
PHP Version : 8.3.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/akhalid/nas-yemen.org/public_html/wp-content/plugins/flamingo/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/akhalid/nas-yemen.org/public_html/wp-content/plugins/flamingo/admin/admin.php
<?php

require_once FLAMINGO_PLUGIN_DIR . '/admin/admin-functions.php';
require_once FLAMINGO_PLUGIN_DIR . '/admin/includes/privacy.php';

add_action( 'admin_menu', 'flamingo_admin_menu', 8, 0 );

function flamingo_admin_menu() {
	add_menu_page(
		__( 'Flamingo Address Book', 'flamingo' ),
		__( 'Flamingo', 'flamingo' ),
		'flamingo_edit_contacts',
		'flamingo',
		'flamingo_contact_admin_page',
		'dashicons-feedback',
		28
	);

	$contact_admin = add_submenu_page(
		'flamingo',
		__( 'Flamingo Address Book', 'flamingo' ),
		__( 'Address Book', 'flamingo' ),
		'flamingo_edit_contacts',
		'flamingo',
		'flamingo_contact_admin_page'
	);

	add_action(
		'load-' . $contact_admin,
		'flamingo_load_contact_admin',
		10, 0
	);

	$inbound_admin = add_submenu_page(
		'flamingo',
		__( 'Flamingo Inbound Messages', 'flamingo' ),
		__( 'Inbound Messages', 'flamingo' ),
		'flamingo_edit_inbound_messages',
		'flamingo_inbound',
		'flamingo_inbound_admin_page'
	);

	add_action(
		'load-' . $inbound_admin,
		'flamingo_load_inbound_admin',
		10, 0
	);
}

add_filter( 'set_screen_option_flamingo_contacts_per_page',
	'flamingo_set_screen_options', 10, 3
);

add_filter( 'set_screen_option_flamingo_inbound_messages_per_page',
	'flamingo_set_screen_options', 10, 3
);

add_filter( 'set_screen_option_flamingo_outbound_messages_per_page',
	'flamingo_set_screen_options', 10, 3
);

function flamingo_set_screen_options( $result, $option, $value ) {
	$flamingo_screens = array(
		'flamingo_contacts_per_page',
		'flamingo_inbound_messages_per_page',
		'flamingo_outbound_messages_per_page',
	);

	if ( in_array( $option, $flamingo_screens ) ) {
		$result = $value;
	}

	return $result;
}

add_action( 'admin_enqueue_scripts', 'flamingo_admin_enqueue_scripts', 10, 1 );

function flamingo_admin_enqueue_scripts( $hook_suffix ) {
	if ( false === strpos( $hook_suffix, 'flamingo' ) ) {
		return;
	}

	wp_enqueue_style( 'flamingo-admin',
		flamingo_plugin_url( 'admin/css/style.css' ),
		array(), FLAMINGO_VERSION, 'all' );

	if ( is_rtl() ) {
		wp_enqueue_style( 'flamingo-admin-rtl',
			flamingo_plugin_url( 'admin/css/style-rtl.css' ),
			array(), FLAMINGO_VERSION, 'all' );
	}

	wp_enqueue_script( 'flamingo-admin',
		flamingo_plugin_url( 'admin/js/script.js' ),
		array( 'postbox' ), FLAMINGO_VERSION, true );

	$current_screen = get_current_screen();

	wp_localize_script( 'flamingo-admin', 'flamingo', array(
		'screenId' => $current_screen->id,
	) );
}

/* Updated Message */

add_action( 'flamingo_admin_updated_message',
	'flamingo_admin_updated_message',
	10, 0
);

function flamingo_admin_updated_message() {
	if ( empty( $_REQUEST['message'] ) ) {
		return;
	}

	if ( 'contactupdated' == $_REQUEST['message'] ) {
		$message = __( 'Contact updated.', 'flamingo' );
	} elseif ( 'contactdeleted' == $_REQUEST['message'] ) {
		$message = __( 'Contact deleted.', 'flamingo' );
	} elseif ( 'inboundupdated' == $_REQUEST['message'] ) {
		$message = __( 'Messages updated.', 'flamingo' );
	} elseif ( 'inboundtrashed' == $_REQUEST['message'] ) {
		$message = __( 'Messages trashed.', 'flamingo' );
	} elseif ( 'inbounduntrashed' == $_REQUEST['message'] ) {
		$message = __( 'Messages restored.', 'flamingo' );
	} elseif ( 'inbounddeleted' == $_REQUEST['message'] ) {
		$message = __( 'Messages deleted.', 'flamingo' );
	} elseif ( 'inboundspammed' == $_REQUEST['message'] ) {
		$message = __( 'Messages got marked as spam.', 'flamingo' );
	} elseif ( 'inboundunspammed' == $_REQUEST['message'] ) {
		$message = __( 'Messages got marked as not spam.', 'flamingo' );
	} elseif ( 'outboundupdated' == $_REQUEST['message'] ) {
		$message = __( 'Messages updated.', 'flamingo' );
	}

	if ( isset( $message ) and '' !== $message ) {
		echo sprintf(
			'<div id="message" class="notice notice-success is-dismissible"><p>%s</p></div>',
			esc_html( $message )
		);
	}
}

/* Contact */

function flamingo_load_contact_admin() {
	$action = flamingo_current_action();

	$redirect_to = menu_page_url( 'flamingo', false );

	if ( 'save' == $action and ! empty( $_REQUEST['post'] ) ) {
		$post = new Flamingo_Contact( $_REQUEST['post'] );

		if ( ! empty( $post ) ) {
			if ( ! current_user_can( 'flamingo_edit_contact', $post->id() ) ) {
				wp_die( __( 'You are not allowed to edit this item.', 'flamingo' ) );
			}

			check_admin_referer( 'flamingo-update-contact_' . $post->id() );

			$post->props = (array) $_POST['contact'];

			$post->name = trim( $_POST['contact']['name'] );

			$post->tags = ! empty( $_POST['tax_input'][Flamingo_Contact::contact_tag_taxonomy] )
				? explode( ',', $_POST['tax_input'][Flamingo_Contact::contact_tag_taxonomy] )
				: array();

			$post->save();

			$redirect_to = add_query_arg(
				array(
					'action' => 'edit',
					'post' => $post->id(),
					'message' => 'contactupdated',
				), $redirect_to
			);
		}

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( 'delete' == $action and ! empty( $_REQUEST['post'] ) ) {
		if ( ! is_array( $_REQUEST['post'] ) ) {
			check_admin_referer( 'flamingo-delete-contact_' . $_REQUEST['post'] );
		} else {
			check_admin_referer( 'bulk-posts' );
		}

		$deleted = 0;

		foreach ( (array) $_REQUEST['post'] as $post ) {
			$post = new Flamingo_Contact( $post );

			if ( empty( $post ) ) {
				continue;
			}

			if ( ! current_user_can( 'flamingo_delete_contact', $post->id() ) ) {
				wp_die( __( 'You are not allowed to delete this item.', 'flamingo' ) );
			}

			if ( ! $post->delete() ) {
				wp_die( __( 'Error in deleting.', 'flamingo' ) );
			}

			$deleted += 1;
		}

		if ( ! empty( $deleted ) ) {
			$redirect_to = add_query_arg(
				array( 'message' => 'contactdeleted' ), $redirect_to );
		}

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( ! empty( $_GET['export'] ) ) {
		check_admin_referer( 'bulk-posts' );

		$sitename = sanitize_key( get_bloginfo( 'name' ) );

		$filename = ( empty( $sitename ) ? '' : $sitename . '-' )
			. sprintf( 'flamingo-contact-%s.csv', wp_date( 'Y-m-d' ) );

		header( 'Content-Description: File Transfer' );
		header( "Content-Disposition: attachment; filename=$filename" );
		header( 'Content-Type: text/csv; charset=' . get_option( 'blog_charset' ) );

		$labels = array(
			__( 'Email', 'flamingo' ),
			__( 'Full name', 'flamingo' ),
			__( 'First name', 'flamingo' ),
			__( 'Last name', 'flamingo' ),
		);

		echo flamingo_csv_row( $labels );

		$args = array(
			'posts_per_page' => -1,
			'orderby' => 'meta_value',
			'order' => 'ASC',
			'meta_key' => '_email',
		);

		if ( ! empty( $_GET['s'] ) ) {
			$args['s'] = $_GET['s'];
		}

		if ( ! empty( $_GET['orderby'] ) ) {
			if ( 'email' == $_GET['orderby'] ) {
				$args['meta_key'] = '_email';
			} elseif ( 'name' == $_GET['orderby'] ) {
				$args['meta_key'] = '_name';
			}
		}

		if ( ! empty( $_GET['order'] )
		and 'asc' == strtolower( $_GET['order'] ) ) {
			$args['order'] = 'ASC';
		}

		if ( ! empty( $_GET['contact_tag_id'] ) ) {
			$args['contact_tag_id'] = explode( ',', $_GET['contact_tag_id'] );
		}

		$items = Flamingo_Contact::find( $args );

		foreach ( $items as $item ) {
			$row = array(
				$item->email,
				$item->get_prop( 'name' ),
				$item->get_prop( 'first_name' ),
				$item->get_prop( 'last_name' ),
			);

			echo "\r\n" . flamingo_csv_row( $row );
		}

		exit();
	}

	if ( ! empty( $_GET['sendmail'] )
	and ! empty( $_REQUEST['contact_tag_id'] ) ) {
		$redirect_to = menu_page_url( 'flamingo_outbound', false );

		$redirect_to = add_query_arg(
			array(
				'action' => 'new',
				'contact_tag_id' => absint( $_REQUEST['contact_tag_id'] ),
			), $redirect_to
		);

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( 'edit' == $action ) {
		$post_id = isset( $_REQUEST['post'] ) ? (int) $_REQUEST['post'] : 0;

		if ( ! $post_id ) {
			wp_safe_redirect( $redirect_to );
			exit();
		}

		if ( ! current_user_can( 'flamingo_edit_contact', $post_id )
		or Flamingo_Contact::post_type !== get_post_type( $post_id ) ) {
			wp_die( __( "You are not allowed to edit this item.", 'flamingo' ) );
		}

		add_meta_box( 'submitdiv', __( 'Save', 'flamingo' ),
			'flamingo_contact_submit_meta_box', null, 'side', 'core' );

		add_meta_box( 'contacttagsdiv', __( 'Tags', 'flamingo' ),
			'flamingo_contact_tags_meta_box', null, 'side', 'core' );

		add_meta_box( 'contactnamediv', __( 'Name', 'flamingo' ),
			'flamingo_contact_name_meta_box', null, 'normal', 'core' );

	} else {
		if ( ! class_exists( 'Flamingo_Contacts_List_Table' ) ) {
			require_once FLAMINGO_PLUGIN_DIR
				. '/admin/includes/class-contacts-list-table.php';
		}

		$current_screen = get_current_screen();

		add_filter( 'manage_' . $current_screen->id . '_columns',
			array( 'Flamingo_Contacts_List_Table', 'define_columns' ),
			10, 0
		);

		add_screen_option( 'per_page', array(
			'default' => 20,
			'option' => 'flamingo_contacts_per_page',
		) );
	}
}

function flamingo_contact_admin_page() {
	if ( 'edit' == flamingo_current_action() ) {
		flamingo_contact_edit_page();
		return;
	}

	$list_table = new Flamingo_Contacts_List_Table();
	$list_table->prepare_items();

?>
<div class="wrap">

<h1 class="wp-heading-inline"><?php
	echo esc_html( __( 'Flamingo Address Book', 'flamingo' ) );
?></h1>

<?php
	if ( ! empty( $_REQUEST['s'] ) ) {
		echo sprintf( '<span class="subtitle">'
			. __( 'Search results for &#8220;%s&#8221;', 'flamingo' )
			. '</span>', esc_html( $_REQUEST['s'] ) );
	}
?>

<hr class="wp-header-end">

<?php do_action( 'flamingo_admin_updated_message' ); ?>

<form method="get" action="">
	<input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
	<?php $list_table->search_box( __( 'Search contacts', 'flamingo' ), 'flamingo-contact' ); ?>
	<?php $list_table->display(); ?>
</form>

</div>
<?php
}

function flamingo_contact_edit_page() {
	$post = new Flamingo_Contact( $_REQUEST['post'] );

	if ( empty( $post ) ) {
		return;
	}

	require_once FLAMINGO_PLUGIN_DIR . '/admin/includes/meta-boxes.php';

	include FLAMINGO_PLUGIN_DIR . '/admin/edit-contact-form.php';
}

/* Inbound Messages */

function flamingo_load_inbound_admin() {
	$action = flamingo_current_action();

	$redirect_to = menu_page_url( 'flamingo_inbound', false );

	if ( isset( $_GET['post_status'] ) ) {
		$redirect_to = add_query_arg(
			array(
				'post_status' => $_GET['post_status'],
			),
			$redirect_to
		);
	}

	if ( 'save' == $action and ! empty( $_REQUEST['post'] ) ) {
		$post = new Flamingo_Inbound_Message( $_REQUEST['post'] );

		if ( ! empty( $post ) ) {
			if ( ! current_user_can( 'flamingo_edit_inbound_message', $post->id() ) ) {
				wp_die( __( 'You are not allowed to edit this item.', 'flamingo' ) );
			}

			check_admin_referer( 'flamingo-update-inbound_' . $post->id() );

			$status = isset( $_POST['inbound']['status'] )
				? $_POST['inbound']['status'] : '';

			if ( ! $post->spam and 'spam' === $status ) {
				$post->spam();
			} elseif ( $post->spam and 'ham' === $status ) {
				$post->unspam();
			}

			$redirect_to = add_query_arg(
				array(
					'action' => 'edit',
					'post' => $post->id(),
					'message' => 'inboundupdated',
				), $redirect_to
			);
		}

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( 'trash' == $action and ! empty( $_REQUEST['post'] ) ) {
		if ( ! is_array( $_REQUEST['post'] ) ) {
			check_admin_referer(
				'flamingo-trash-inbound-message_' . $_REQUEST['post'] );
		} else {
			check_admin_referer( 'bulk-posts' );
		}

		$trashed = 0;

		foreach ( (array) $_REQUEST['post'] as $post ) {
			$post = new Flamingo_Inbound_Message( $post );

			if ( empty( $post ) ) {
				continue;
			}

			if ( ! current_user_can(
			'flamingo_delete_inbound_message', $post->id() ) ) {
				wp_die( __( 'You are not allowed to move this item to the Trash.', 'flamingo' ) );
			}

			if ( ! $post->trash() ) {
				wp_die( __( 'Error in moving to Trash.', 'flamingo' ) );
			}

			$trashed += 1;
		}

		if ( ! empty( $trashed ) ) {
			$redirect_to = add_query_arg(
				array(
					'message' => 'inboundtrashed',
				),
				$redirect_to
			);
		}

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( 'untrash' == $action and ! empty( $_REQUEST['post'] ) ) {
		if ( ! is_array( $_REQUEST['post'] ) ) {
			check_admin_referer(
				'flamingo-untrash-inbound-message_' . $_REQUEST['post'] );
		} else {
			check_admin_referer( 'bulk-posts' );
		}

		$untrashed = 0;

		foreach ( (array) $_REQUEST['post'] as $post ) {
			$post = new Flamingo_Inbound_Message( $post );

			if ( empty( $post ) ) {
				continue;
			}

			if ( ! current_user_can(
			'flamingo_delete_inbound_message', $post->id() ) ) {
				wp_die( __( 'You are not allowed to restore this item from the Trash.', 'flamingo' ) );
			}

			if ( ! $post->untrash() ) {
				wp_die( __( 'Error in restoring from Trash.', 'flamingo' ) );
			}

			$untrashed += 1;
		}

		if ( ! empty( $untrashed ) ) {
			$redirect_to = add_query_arg(
				array(
					'message' => 'inbounduntrashed',
				), $redirect_to
			);
		}

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( 'delete_all' == $action ) {
		check_admin_referer( 'bulk-posts' );

		$_REQUEST['post'] = flamingo_get_all_ids_in_trash(
			Flamingo_Inbound_Message::post_type );

		$action = 'delete';
	}

	if ( 'delete' == $action and ! empty( $_REQUEST['post'] ) ) {
		if ( ! is_array( $_REQUEST['post'] ) ) {
			check_admin_referer(
				'flamingo-delete-inbound-message_' . $_REQUEST['post'] );
		} else {
			check_admin_referer( 'bulk-posts' );
		}

		$deleted = 0;

		foreach ( (array) $_REQUEST['post'] as $post ) {
			$post = new Flamingo_Inbound_Message( $post );

			if ( empty( $post ) ) {
				continue;
			}

			if ( ! current_user_can(
			'flamingo_delete_inbound_message', $post->id() ) ) {
				wp_die( __( 'You are not allowed to delete this item.', 'flamingo' ) );
			}

			if ( ! $post->delete() ) {
				wp_die( __( 'Error in deleting.', 'flamingo' ) );
			}

			$deleted += 1;
		}

		if ( ! empty( $deleted ) ) {
			$redirect_to = add_query_arg(
				array(
					'message' => 'inbounddeleted',
				),
				$redirect_to
			);
		}

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( 'spam' == $action and ! empty( $_REQUEST['post'] ) ) {
		if ( ! is_array( $_REQUEST['post'] ) ) {
			check_admin_referer(
				'flamingo-spam-inbound-message_' . $_REQUEST['post'] );
		} else {
			check_admin_referer( 'bulk-posts' );
		}

		$submitted = 0;

		foreach ( (array) $_REQUEST['post'] as $post ) {
			$post = new Flamingo_Inbound_Message( $post );

			if ( empty( $post ) ) {
				continue;
			}

			if ( ! current_user_can( 'flamingo_spam_inbound_message', $post->id() ) ) {
				wp_die( __( 'You are not allowed to spam this item.', 'flamingo' ) );
			}

			if ( $post->spam() ) {
				$submitted += 1;
			}
		}

		if ( ! empty( $submitted ) ) {
			$redirect_to = add_query_arg(
				array(
					'message' => 'inboundspammed',
				),
				$redirect_to
			);
		}

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( 'unspam' == $action and ! empty( $_REQUEST['post'] ) ) {
		if ( ! is_array( $_REQUEST['post'] ) ) {
			check_admin_referer(
				'flamingo-unspam-inbound-message_' . $_REQUEST['post'] );
		} else {
			check_admin_referer( 'bulk-posts' );
		}

		$submitted = 0;

		foreach ( (array) $_REQUEST['post'] as $post ) {
			$post = new Flamingo_Inbound_Message( $post );

			if ( empty( $post ) ) {
				continue;
			}

			if ( ! current_user_can(
			'flamingo_unspam_inbound_message', $post->id() ) ) {
				wp_die( __( 'You are not allowed to unspam this item.', 'flamingo' ) );
			}

			if ( $post->unspam() ) {
				$submitted += 1;
			}
		}

		if ( ! empty( $submitted ) ) {
			$redirect_to = add_query_arg(
				array(
					'message' => 'inboundunspammed',
				),
				$redirect_to
			);
		}

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( ! empty( $_GET['export'] ) ) {
		check_admin_referer( 'bulk-posts' );

		$sitename = sanitize_key( get_bloginfo( 'name' ) );

		$filename = ( empty( $sitename ) ? '' : $sitename . '-' )
			. sprintf( 'flamingo-inbound-%s.csv', wp_date( 'Y-m-d' ) );

		header( 'Content-Description: File Transfer' );
		header( "Content-Disposition: attachment; filename=$filename" );
		header( 'Content-Type: text/csv; charset=' . get_option( 'blog_charset' ) );

		$args = array(
			'posts_per_page' => -1,
			'orderby' => 'date',
			'order' => 'DESC',
		);

		if ( ! empty( $_REQUEST['s'] ) ) {
			$args['s'] = $_REQUEST['s'];
		}

		if ( ! empty( $_REQUEST['orderby'] ) ) {
			if ( 'subject' == $_REQUEST['orderby'] ) {
				$args['meta_key'] = '_subject';
				$args['orderby'] = 'meta_value';
			} elseif ( 'from' == $_REQUEST['orderby'] ) {
				$args['meta_key'] = '_from';
				$args['orderby'] = 'meta_value';
			}
		}

		if ( ! empty( $_REQUEST['order'] )
		and 'asc' == strtolower( $_REQUEST['order'] ) ) {
			$args['order'] = 'ASC';
		}

		if ( ! empty( $_REQUEST['m'] ) ) {
			$args['m'] = $_REQUEST['m'];
		}

		if ( ! empty( $_REQUEST['channel_id'] ) ) {
			$args['channel_id'] = $_REQUEST['channel_id'];
		}

		if ( ! empty( $_REQUEST['channel'] ) ) {
			$args['channel'] = $_REQUEST['channel'];
		}

		$items = Flamingo_Inbound_Message::find( $args );

		if ( empty( $items ) ) {
			exit();
		}

		$labels = array_keys( $items[0]->fields );

		echo flamingo_csv_row(
			array_merge( $labels, array( __( 'Date', 'flamingo' ) ) ) );

		foreach ( $items as $item ) {
			$row = array();

			foreach ( $labels as $label ) {
				$col = isset( $item->fields[$label] ) ? $item->fields[$label] : '';

				if ( is_array( $col ) ) {
					$col = flamingo_array_flatten( $col );
					$col = array_filter( array_map( 'trim', $col ) );
					$col = implode( ', ', $col );
				}

				$row[] = $col;
			}

			$row[] = get_post_time( 'c', false, $item->id() ); // Date

			echo "\r\n" . flamingo_csv_row( $row );
		}

		exit();
	}

	if ( 'edit' == $action ) {
		$post_id = isset( $_REQUEST['post'] ) ? (int) $_REQUEST['post'] : 0;

		if ( ! $post_id ) {
			wp_safe_redirect( $redirect_to );
			exit();
		}

		if ( ! current_user_can( 'flamingo_edit_inbound_message', $post_id )
		or Flamingo_Inbound_Message::post_type !== get_post_type( $post_id ) ) {
			wp_die( __( "You are not allowed to edit this item.", 'flamingo' ) );
		}

		$post = new Flamingo_Inbound_Message( $post_id );

		add_meta_box( 'submitdiv', __( 'Status', 'flamingo' ),
			'flamingo_inbound_submit_meta_box', null, 'side', 'core' );

		if ( ! empty( $post->fields ) ) {
			add_meta_box( 'inboundfieldsdiv', __( 'Fields', 'flamingo' ),
				'flamingo_inbound_fields_meta_box', null, 'normal', 'core' );
		}

		if ( ! empty( $post->consent ) ) {
			add_meta_box( 'inboundconsentdiv', __( 'Consent', 'flamingo' ),
				'flamingo_inbound_consent_meta_box', null, 'normal', 'core' );
		}

		if ( ! empty( $post->recaptcha ) ) {
			add_meta_box( 'inboundrecaptchadiv', __( 'reCAPTCHA', 'flamingo' ),
				'flamingo_inbound_recaptcha_meta_box', null, 'normal', 'core' );
		}

		if ( ! empty( $post->meta ) ) {
			add_meta_box( 'inboundmetadiv', __( 'Meta', 'flamingo' ),
				'flamingo_inbound_meta_meta_box', null, 'normal', 'core' );
		}

	} else {
		if ( ! class_exists( 'Flamingo_Inbound_Messages_List_Table' ) ) {
			require_once FLAMINGO_PLUGIN_DIR . '/admin/includes/class-inbound-messages-list-table.php';
		}

		$current_screen = get_current_screen();

		add_filter( 'manage_' . $current_screen->id . '_columns',
			array( 'Flamingo_Inbound_Messages_List_Table', 'define_columns' ),
			10, 0
		);

		add_screen_option( 'per_page', array(
			'default' => 20,
			'option' => 'flamingo_inbound_messages_per_page',
		) );
	}
}

function flamingo_inbound_admin_page() {
	if ( 'edit' == flamingo_current_action() ) {
		flamingo_inbound_edit_page();
		return;
	}

	$list_table = new Flamingo_Inbound_Messages_List_Table();
	$list_table->prepare_items();

?>
<div class="wrap">

<h1 class="wp-heading-inline"><?php
	echo esc_html( __( 'Inbound Messages', 'flamingo' ) );
?></h1>

<?php
	if ( ! empty( $_REQUEST['s'] ) ) {
		echo sprintf( '<span class="subtitle">'
			. __( 'Search results for &#8220;%s&#8221;', 'flamingo' )
			. '</span>', esc_html( $_REQUEST['s'] ) );
	}
?>

<hr class="wp-header-end">

<?php do_action( 'flamingo_admin_updated_message' ); ?>

<?php $list_table->views(); ?>

<form method="get" action="">
	<input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
	<input type="hidden" name="post_status" value="<?php echo isset( $_REQUEST['post_status'] ) ? esc_attr( $_REQUEST['post_status'] ) : ''; ?>" />
	<?php $list_table->search_box( __( 'Search messages', 'flamingo' ), 'flamingo-inbound' ); ?>
	<?php $list_table->display(); ?>
</form>

</div>
<?php
}

function flamingo_inbound_edit_page() {
	$post = new Flamingo_Inbound_Message( $_REQUEST['post'] );

	if ( empty( $post ) ) {
		return;
	}

	require_once FLAMINGO_PLUGIN_DIR . '/admin/includes/meta-boxes.php';

	include FLAMINGO_PLUGIN_DIR . '/admin/edit-inbound-form.php';
}

/* Outbound Messages */

function flamingo_load_outbound_admin() {
	$action = flamingo_current_action();

	$redirect_to = menu_page_url( 'flamingo_outbound', false );

	$post_id = ! empty( $_REQUEST['post'] ) ? $_REQUEST['post'] : '';

	if ( 'save' == $action ) {
		if ( $post_id ) {
			check_admin_referer( 'flamingo-update-outbound_' . $post_id );
		} else {
			check_admin_referer( 'flamingo-add-outbound' );
		}

		if ( ! empty( $_REQUEST['send'] ) ) {
			// send mail
		}

		if ( $post_id ) {
			if ( ! current_user_can( 'flamingo_edit_outbound_message', $post_id ) ) {
				wp_die( __( 'You are not allowed to edit this item.', 'flamingo' ) );
			}

//			$post = new Flamingo_Outbound_Message( $post_id );
		} else {
//			$post = Flamingo_Outbound_Message::add();
		}

		//$post->save();

		$redirect_to = add_query_arg(
			array(
				'action' => 'edit',
				//'post' => $post->id(),
				'message' => 'outboundupdated',
			), $redirect_to
		);

		wp_safe_redirect( $redirect_to );
		exit();
	}

	if ( 'new' == $action ) {
		add_meta_box( 'submitdiv', __( 'Send', 'flamingo' ),
			'flamingo_outbound_submit_meta_box', null, 'side', 'core' );

	} else {
		if ( ! class_exists( 'Flamingo_Outbound_Messages_List_Table' ) ) {
			require_once FLAMINGO_PLUGIN_DIR . '/admin/includes/class-outbound-messages-list-table.php';
		}

		$current_screen = get_current_screen();

		add_filter( 'manage_' . $current_screen->id . '_columns',
			array( 'Flamingo_Outbound_Messages_List_Table', 'define_columns' ),
			10, 0
		);

		add_screen_option( 'per_page', array(
			'default' => 20,
			'option' => 'flamingo_outbound_messages_per_page',
		) );
	}
}

function flamingo_outbound_admin_page() {
	if ( 'new' == flamingo_current_action() ) {
		flamingo_outbound_edit_page();
		return;
	}

	$list_table = new Flamingo_Outbound_Messages_List_Table();
	$list_table->prepare_items();

?>
<div class="wrap">

<h1 class="wp-heading-inline"><?php
	echo esc_html( __( 'Outbound Messages', 'flamingo' ) );
?></h1>

<?php
	if ( ! empty( $_REQUEST['s'] ) ) {
		echo sprintf( '<span class="subtitle">'
			. __( 'Search results for &#8220;%s&#8221;', 'flamingo' )
			. '</span>', esc_html( $_REQUEST['s'] ) );
	}
?>

<hr class="wp-header-end">

<?php do_action( 'flamingo_admin_updated_message' ); ?>

<?php $list_table->views(); ?>

<form method="get" action="">
	<input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
	<?php $list_table->search_box( __( 'Search messages', 'flamingo' ), 'flamingo-outbound' ); ?>
	<?php $list_table->display(); ?>
</form>

</div>
<?php
}

function flamingo_outbound_edit_page() {
	$action = flamingo_current_action();
	$post = null;

	if ( 'edit' == $action ) {
		$post = new Flamingo_Outbound_Message( $_REQUEST['post'] );

		if ( empty( $post ) ) {
			return;
		}
	} else { // maybe 'new' == $action
		if ( ! empty( $_REQUEST['contact_tag_id'] ) ) {
			$tag_id = explode( ',', $_REQUEST['contact_tag_id'] );

			$contact_tag = get_term( $tag_id[0],
				Flamingo_Contact::contact_tag_taxonomy );

			if ( empty( $contact_tag ) or is_wp_error( $contact_tag ) ) {
				$contact_tag = null;
			}
		}
	}

	require_once FLAMINGO_PLUGIN_DIR . '/admin/includes/meta-boxes.php';
	include FLAMINGO_PLUGIN_DIR . '/admin/edit-outbound-form.php';
}

Youez - 2016 - github.com/yon3zu
LinuXploit