Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Mubashier {
- var $driver_name = 'PDO';
- var $manager = false;
- var $webpage_id = null;
- var $live_webpage = false;
- private $initialized = false;
- private $sessionState = Mubashier::SESSION_STATE_UNINITIALIZED;
- private $pdo = null;
- private $pdo_structure = null;
- private $config = null;
- private $cats = null;
- private $featured_sliders = null;
- private $user_groups = null;
- private $sources = null;
- private $pages = array( );
- private $touch_mode = false;
- private $types = array( 1 => 'أخبار', 2 => 'فيديوهات', 3 => 'صور', 4 => 'مقالات' );
- private $types_prefix = array( 1 => 'index', 2 => 'videos', 3 => 'photos', 4 => 'articles', 5 => 'gif' );
- private $translation = array( );
- private $db_info = array( );
- private $html = array( 'header' => array( ), 'footer' => array( ) );
- private $javascript_options = null;
- private $css = null;
- private $js = array( );
- var $js_place = 'header';
- var $ad_sizes = array( 0 => array( 0 => 160, 1 => 600 ), 1 => array( 0 => 120, 1 => 600 ), 2 => array( 0 => 180, 1 => 600 ), 3 => array( 0 => 200, 1 => 200 ), 4 => array( 0 => 250, 1 => 250 ), 5 => array( 0 => 300, 1 => 250 ), 6 => array( 0 => 336, 1 => 280 ), 7 => array( 0 => 728, 1 => 90 ), 8 => array( 0 => 468, 1 => 60 ), 9 => array( 0 => 300, 1 => 600 ), 10 => array( 0 => 320, 1 => 50 ), 11 => array( 0 => 320, 1 => 75 ), 12 => array( 0 => 180, 1 => 227 ), 13 => array( 0 => 780, 1 => 40 ), 14 => array( 0 => 970, 1 => 90 ) );
- private $mime_types = array( 'video' => array( 'video/mp4' => 'mp4', 'video/m4v' => 'm4v', 'video/mov' => 'mov', 'video/wmv' => 'wmv', 'video/flv|video/x-flv' => 'flv' ), 'audio' => array( 'audio/wma' => 'wma', 'audio/m4a' => 'm4a', 'audio/mp3' => 'mp3', 'audio/wav' => 'wav', 'audio/mpeg' => 'mpeg', 'audio/flv|audio/x-flv' => 'flv' ), 'image' => array( 'image/gif' => 'gif', 'image/jpeg' => 'jpg', 'image/jpg' => 'jpg', 'image/png' => 'png', 'image/x-ms-bmp' => 'bmp' ), 'flash' => array( 'application/x-shockwave-flash' => 'swf' ), 'compressed' => array( 'application/x-bzip' => 'bz', 'application/x-bzip2' => 'bz2', 'application/zip' => 'zip', 'application/x-rar-compressed' => 'rar' ), 'text' => array( 'application/x-sql' => 'sql', 'text/plain' => 'txt', 'application/pdf' => 'pdf', 'application/force-download' => 'pdf', 'application/msword' => 'doc', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx' ) );
- var $inits = array( );
- var $theme_features = array( 'general_scripts' => true, 'navbars' => true, 'ads' => true, 'polls' => false, 'outside_services' => false );
- private $vars_data = array( );
- var $executions_time = array( );
- var $lang_pakgs = array( 0 => 'root', 1 => 'theme' );
- var $temp_opt_handler = 'cache';
- function __construct($db_connection = true, $session_start = true) {
- Mubashier::protect( );
- VERSION;
- $this->version = ;
- $config_file = dirname( __FILE__ ) . DS . 'config.inc.php';
- if (file_exists( $config_file )) {
- if (include( $config_file )) {
- $this->db_info = ;
- if (true = $session_start) {
- $this->session_start( );
- require_once( dirname( __FILE__ ) . '/phpfastcache/3.0.0/phpfastcache.php' );
- defined;
- 'C_STORAGE';
- }
- if (( ) = true) {
- $config = array( 'storage' => C_STORAGE, 'htaccess' => true, 'path' => C_PATH, 'securityKey' => 'default', 'extensions' => array( ), 'fallback' => 'files' );
- }
- }
- function __destruct() {
- (bool);
- $webpage_caching;
- if (( $this->live_webpage && )) {
- ob_get_contents( );
- $html = ;
- __c( )->set( $this->webpage_id, $html, C_WEBPAGE_LIFETIME );
- $this->pdo = ;
- $this->db = ;
- PHP_SESSION_ACTIVE = session_status( );
- ( || ( 50400 <= PHP_VERSION_ID && ) );
- PHP_VERSION_ID;
- }
- isset( $ );
- session_id( );
- ( ( < 50400 && ) && );
- if ((bool)) {
- }
- session_write_close( );
- return ;
- }
- function beforeCacheActions() {
- while (true) {
- defined( 'INTERNAL_UPDATE' );
- if (( defined( 'IS_VIEW_PAGE' ) && )) {
- $id = (int);
- self::getStatsDBPath( );
- $stats_db = ;
- if (self::check_user_agent( 'bot' ) = true) {
- self::updateStatsDBData;
- }
- }
- ( $stats_db, $id, 'bot_views', '+1' );
- }
- self::updateStatsDBData( $stats_db, $id, 'views', '+1' );
- self::closeStatsDB( );
- return ;
- }
- function getDbInfo($key) {
- return ;
- }
- function runDbQuery($sql) {
- $this->Pdo( )->prepare( $sql )->execute( );
- return ;
- }
- function Pdo() {
- return ;
- }
- function dbTable($table) {
- return ;
- }
- function db_connect($dsn, $username = '', $password = '', $driver_options = array( )) {
- strtolower( trim( substr( $dsn, 0, strpos( $dsn, ':' ) ) ) );
- $driver = ;
- ( 'PDO' );
- }
- function protect() {
- (bool);
- while (true) {
- while (true) {
- while (true) {
- while (true) {
- strpos( urldecode( $['QUERY_STRING'] ), chr( 0 ) ) !== false;
- if (( isset( $['QUERY_STRING'] ) && )) {
- exit( );
- isset( $ );
- if (( @ini_get( 'register_globals' ) && )) {
- each( $ )[1];
- $value = ;
- [0];
- $key = ;
- if () {
- $[$key] = null;
- unset( $[$key] );
- }
- }
- }
- else {
- foreach ($targets as ) {
- $target = ;
- if (isset( $[$target] )) {
- htmlspecialchars;
- }
- $[$target];
- }
- }
- ( ENT_QUOTES );
- $[$target] = (true ? : );
- }
- if (get_magic_quotes_gpc( )) {
- $process = array( $ => , $ => , $ => , $ => );
- each( $process )[1];
- $val = ;
- [0];
- $key = ;
- if () {
- foreach ($val as ) {
- }
- }
- }
- $v = ;
- $k = ;
- unset( $process[$key][$k] );
- if (is_array( $v )) {
- $process[$key][stripslashes( $k )] = $v;
- }
- $process[] = &$process[$key][stripslashes( $k )];
- }
- $process[$key][stripslashes( $k )] = stripslashes( $v );
- }
- }
- unset( $$process );
- return ;
- }
- function iframe_regexp($append_urls = array( )) {
- $this->getOption( 'iframe_regexp' );
- $db_regexp = ;
- if (empty( $$db_regexp ) = false) {
- explode( '
- ', $db_regexp );
- }
- $db_regexp = ;
- if (0 < count( $db_regexp )) {
- '|' . implode( '|', $db_regexp );
- $iframe_names &= (true ? : );
- empty( $$append_urls ) = false;
- if (( is_string( $append_urls ) && )) {
- $append_urls = array( $append_urls => );
- 0 < count( $append_urls );
- if (( is_array( $append_urls ) = true && )) {
- }
- }
- foreach ($append_urls as ) {
- $url = ;
- }
- }
- while (true) {
- tools::strToDomain( $url );
- if ($domain = $iframe_names = IFRAME_NAMES) {
- $iframe_names &= '|' . $domain;
- break;
- }
- }
- return ;
- }
- function start($_smarty = true, $_manager = false, $_utility = true, $_session = true, $_nocaching = false) {
- while (!) {
- microtime( true );
- $before_microtime = ;
- $this->manager = ;
- $this->getConfig( $_nocaching );
- self;
- if ($_manager = false) {
- $this->getThemePath( '' );
- $theme_path = (true ? : );
- date_default_timezone_set( $this->getOption( 'timezone', 'Africa/Cairo' ) );
- self::loadClass( 'tools', 'tools' );
- new ( $this->config );
- $this->tools = ;
- self::loadClass( 'translator', 'tools' );
- Translator::init( $this->getLangsArray( $this->lang_pakgs ) );
- if ($_manager = true) {
- $this->checkLicense( );
- __c( )->get( $this->cacheId( 'user', 'groups' ) );
- if ($this->user_groups = = null) {
- array( );
- $this->user_groups = ;
- foreach ($this->db->user_groups( 'status', 1 ) as ) {
- $group = ;
- $this->user_groups[$group['id']] = array( 'id' => (int), 'title' => $group['title'], 'description' => $group['description'], 'directory' => (string), 'user_join' => (string), 'listings_approval' => (string) );
- break;
- }
- __c( )->set( $this->cacheId( 'user', 'groups' ), $this->user_groups, C_LIFETIME_D );
- microtime( true );
- $before_cats_microtime = ;
- __c( )->get;
- $this->cacheId( 'cats' );
- }
- }
- }
- }
- ( );
- if ($this->cats = = null) {
- self::categoryDefaultOptions( );
- $default_cat_options = ;
- foreach ($this->db->cats( ) as ) {
- $cat = ;
- $cat_options = (array);
- $cat['id'];
- array( 'id' => (int) );
- if ((int) = (int)) {
- (int);
- $this->cats[] = array( 'parent' => (true ? : ), 'prefix' => $cat['prefix'], 'title' => $cat['title'], 'url' => $this->tools->custom_url( 'cat', array( 'id' => $cat['id'], 'prefix' => $cat['prefix'], 'type' => 'index' ) ), 'listings' => 0, 'description' => $this->tools->limit( $cat['description'], 250 ), 'keywords' => $this->tools->limit( $cat['keywords'], 250 ), 'options' => self::array_merge_recursive_distinct( $default_cat_options, $cat_options ) );
- break;
- }
- break;
- }
- __c( )->set( $this->cacheId( 'cats' ), $this->cats, C_LIFETIME_C );
- $this->executions_time['load_cats'] = microtime( true ) - $before_cats_microtime;
- microtime( true );
- $before_sources_microtime = ;
- __c( )->get( $this->cacheId( 'sources' ) );
- if ($this->sources = = null) {
- foreach ($this->db->sources( )->order( '`sort` ASC' ) as ) {
- $source = ;
- }
- }
- }
- }
- }
- while (true) {
- $this->sources[(int)] = array( 'id' => (int), 'title' => $dez_var_13['title'], 'logo' => $dez_var_13['logo'], 'source_url' => $dez_var_13['url'], 'type' => (int), 'prefix' => $dez_var_13['prefix'], 'fetchedon' => (int), 'poststatus' => (int), 'url' => $this->tools->custom_url( 'source', array( 'id' => (int), 'title' => $dez_var_13['title'] ) ), 'released' => (int), 'active' => (string) );
- }
- __c( )->set( $this->cacheId( 'sources' ), $this->sources, C_LIFETIME_D );
- $this->executions_time['load_sources'] = microtime( true ) - $prefix;
- __c( )->get( $this->cacheId( 'featured_sliders' ) );
- if ($this->featured_sliders = = null) {
- foreach ($this->db->featured_sliders( 'theme', $this->getOption( 'theme' ) ) as ) {
- $dez_var_14 = ;
- $this->featured_sliders[$dez_var_14['name']] = array( 'id' => (int), 'name' => $dez_var_14['name'], 'title' => $dez_var_14['title'], 'slides_num' => (int), 'auto' => (string), 'auto_field' => $dez_var_14['auto_field'], 'auto_types' => (array), 'auto_duration' => $dez_var_14['auto_duration'], 'auto_cats' => (array), 'expire' => (int) );
- break;
- }
- __c( )->set( $this->cacheId( 'featured_sliders' ), $this->featured_sliders, C_LIFETIME_D );
- $this->loadClass( 'auth', 'auth' );
- new ( $dez_var_15, $db_info );
- $this->auth = ;
- if ($config_file = true) {
- $this->loadClass( 'rows', 'data' );
- new ( $dez_var_15 );
- $this->rows = ;
- if ($db_connection = true) {
- new ( );
- $this->smarty = ;
- if (( $this->loadClass( 'smarty', 'smarty' ) && )) {
- $session_start = false;
- if (( (string) = true && )) {
- $this->setTheme( 'global' );
- $this->getThemePath( );
- $this->smarty->template_dir = ;
- $this->getOption( 'cache_path' );
- $this->smarty->compile_dir = ;
- array( $this->getOption( 'base_path' ) . 'libs/smarty/plugins' => );
- $this->smarty->plugins_dir = ;
- $this->smarty->assign( 'AssetsUrl', $this->getThemeUrl( 'assets' ) );
- if ($session_start = false) {
- include( sprintf( '%sthemes/%s/init.php', $this->getOption( 'base_path' ), $this->getTheme( ) ) );
- if ($this->theme_features['general_scripts'] = true) {
- if ((string) = true) {
- $this->html( $this->javascript_code( 'if( (self.parent && !(self.parent===self)) && (self.parent.frames.length!=0) ){setTimeout(function(){self.parent.location=document.location},9000);}' ) );
- if ($this->auth->logged( ) = true) {
- $this->auth->user;
- }
- }
- }
- }
- }
- }
- }
- }
- in_array( $this->tools->get_cuurent_file( ), array( 'notification' => ) ) = false;
- if (( 0 < ['notifications'] && )) {
- $this->html( $this->javascript_code( 'if ( typeof notifications !== \'undefined\' ) {notifications(' . . $this->auth->user['notifications'] . ');}' ), 'footer' );
- if ($this->theme_features['polls'] = true) {
- $this->loadClass( 'polls', 'tools' );
- new ( $dez_var_15 );
- $this->polls = ;
- $this->smarty->assign( 'poll', $this->polls->display( ) );
- if ($this->theme_features['outside_services'] = true) {
- $dez_var_16 = array( 'currency' => 'العملات', 'praytime' => 'أوقات الصلاة', 'weather' => 'الطقس' );
- foreach ($dez_var_16 as ) {
- $dez_var_18 = ;
- $dez_var_17 = ;
- if ((string) = false) {
- unset( $dez_var_16[$dez_var_17] );
- break;
- }
- break;
- }
- $this->smarty->assign( 'outside_services', $dez_var_16 );
- if ($this->theme_features['ads'] = true) {
- }
- }
- }
- $this->smarty->assign( 'adsArray', $this->adsArray( ) );
- $this->smarty->assign( 'adsCount', 0 );
- if ($this->theme_features['navbars'] = true) {
- $this->smarty->assign;
- 'Navbars';
- $this->getNavbars( );
- }
- ( );
- $this->smarty->assign( 'viewsCount', 0 );
- $this->smarty->assign( 'publicGroups', $this->auth->publicGroups( ) );
- $this->smarty->assign( 'LoginProviders', $this->auth->LoginProviders( ) );
- $this->smarty->assign( 'EnabledLoginProviders', $this->auth->EnabledLoginProviders( ) );
- $this->smarty->assign( 'upload', array( 'mime_types_pkgs' => $this->mime_types, 'mime_types' => $this->get_mime_types( ), 'extensions' => $this->get_extensions( ), 'max_file_size' => (int) + 1024 + 1024 ) );
- if ((string) = true) {
- $this->siteStats( );
- $this->smarty->assign;
- }
- }
- }
- ( 'theme', $this->getTheme( ) );
- $this->smarty->assign( 'lang', $this->getLang( ) );
- $this->smarty->assign( 'config', $this->getConfigTpl( ) );
- $this->smarty->assign( 'user', $this->auth->data( ) );
- $this->smarty->assign( 'tools', $this->tools );
- $this->smarty->assign( 'isMobile', self::check_user_agent( 'mobile' ) );
- $this->smarty->assign( 'isBot', self::check_user_agent( 'bot' ) );
- basename( $['SCRIPT_FILENAME'] );
- $dez_var_19 = ;
- $session_start = false;
- if (( (string) = true && )) {
- if ($this->auth->logged( ) = true) {
- $this->smarty->assign( 'msg', $this->getOption( 'site_close_text' ) );
- $this->display( 'pages/msg.tpl', $this->getOption( 'site_name' ) );
- exit( );
- }
- }
- else {
- if ((bool)) {
- $this->auth->is_manager( ) = false;
- }
- ( && );
- }
- in_array( $dez_var_19, array( 'login.php' => , 'ajax.php' => ) ) = false;
- if ((bool)) = ;
- $this->initialized = ;
- return ;
- }
- function loadLangPkgs($pkgs) {
- array_merge( $this->lang_pakgs, $pkgs );
- $this->lang_pakgs = ;
- return ;
- }
- function getLangsArray($pkgs = array( 0 => 'root' )) {
- $translation = array( );
- foreach ($pkgs as ) {
- $pkg = ;
- if ($pkg = 'theme') {
- $this->getThemePath( 'Langs' . DS . $this->getLang( ) . '.php' );
- $lang_file = ;
- break;
- }
- jmp;
- break;
- }
- return ;
- }
- function siteStats() {
- $this->getOption( 'site_stats' );
- $site_stats_data = ;
- $site_stats = array( );
- foreach ((array) as ) {
- $source_count = ;
- $source_id = ;
- $site_stats['sources'][$source_id] = $this->getSource( $source_id, null, false );
- $site_stats['sources'][$source_id]['count'] = $source_count;
- break;
- }
- foreach ((array) as ) {
- $cat_count = ;
- $cat_id = ;
- $site_stats['cats'][$cat_id] = $this->catgory( $cat_id );
- $site_stats['cats'][$cat_id]['count'] = $cat_count;
- break;
- }
- $this->config['site_stats'] = $site_stats;
- return ;
- }
- function adsArray() {
- while (true) {
- __c( )->get( $this->cacheId( 'adsArray' ) );
- if ($ads = = null) {
- $ads = array( );
- foreach ($this->db->ads( ) as ) {
- }
- }
- $ad_row = ;
- $ads[$ad_row['width'] . 'x' . $ad_row['height']][] = array( 'id' => $ad_row['id'], 'code' => $ad_row['code'] );
- }
- __c( )->set( $this->cacheId( 'adsArray' ), $ads, C_LIFETIME );
- return ;
- }
- function sourcesChunks() {
- array_keys( (array) );
- $sources = ;
- if (count( $sources ) = 0) {
- return ;
- $fetcher_chunks = (int);
- array_chunk;
- $sources;
- ceil;
- count;
- $sources;
- }
- return ;
- }
- function catgory($id) {
- $uncategorized = array( 'id' => 0, 'prefix' => 'uncategorized', 'title' => 'غير مصنف', 'url' => $this->tools->custom_url( 'cat', array( 'id' => 0, 'prefix' => 'uncategorized', 'type' => 'index' ) ) );
- if (isset( $this->cats[$id] ) = true) {
- $this->cats[$id];
- }
- return ;
- }
- function catgories_select_tree($select = '-- اختار واحدة --') {
- while (is_array( $select )) {
- $cats = $select;
- }
- jmp;
- array( );
- $cats = (true ? : );
- foreach ($this->catgories_tree( ) as ) {
- $parent = ;
- $cats[$parent['id']] = '+ ' . $parent['title'];
- foreach ($parent['subcategories'] as ) {
- $sub = ;
- $cats[$sub['id']] = ' ¦ ' . . $sub['title'];
- break 2;
- }
- break;
- }
- return ;
- }
- function catgories_tree() {
- $cats = array( );
- $data_source = (array);
- foreach ($this->catsToTree( $data_source ) as ) {
- $cat = ;
- $cat['listings'];
- $listings = $sub = array( );
- foreach ($cat['subcategories'] as ) {
- $sub['listings'];
- $listings += $sub = ;
- $cats[$cat['id']]['subcategories'][$sub['id']] = $sub;
- break 2;
- }
- $cat['listings'] = $listings;
- $cats[$cat['id']] = $cat;
- break;
- }
- return ;
- }
- function catsToTree(&$categories, $sub_key = 'subcategories') {
- while (true) {
- while (count( $categories ) = 0) {
- return ;
- $map = array( 0 => array( $sub_key => array( ) ) );
- foreach ($categories as ) {
- $category = &;
- $category[$sub_key] = array( );
- $map[$category['id']] = &$category;
- break;
- }
- foreach ($categories as ) {
- }
- }
- $category = &;
- $map[$category['parent']][$sub_key][$category['id']] = &$category;
- }
- return ;
- }
- function get_types($type = 0) {
- if ($type = 0) {
- $this->types;
- ;
- $this->types;
- }
- [$type];
- return ;
- }
- function before_last_update($period = 14, $o = '-') {
- if (0 < (int)) {
- (int);
- ;
- time( );
- }
- $last_update = ;
- return ;
- }
- function add_points($userid = 0, $key = '', $description = '') {
- if ((string) = false) {
- return ;
- json_decode;
- $this->getOption;
- 'points_values';
- }
- ( ( ), true );
- $values = ;
- $points = (int);
- $this->db->points( )->insert( array( 'user_id' => $userid, 'points' => $points, 'description' => $description, 'time' => time( ) ) );
- return ;
- }
- function sortArrayByArray($array, $orderArray) {
- $ordered = array( );
- foreach ($orderArray as ) {
- $key = ;
- if (array_key_exists( $key, $array )) {
- $ordered[$key] = $array[$key];
- unset( $array[$key] );
- break;
- }
- break;
- }
- return ;
- }
- function type_to_prefix($type) {
- return ;
- }
- function getAdSizes() {
- return ;
- }
- function delete_recursive($table, $id, $parent = 'parent_id') {
- foreach ($this->db->$table( $parent, $id ) as ) {
- $child = ;
- $this->delete_recursive( $table, $child['id'], $parent );
- $child->delete( );
- }
- $this->db->$table( 'id', $id )->delete( );
- return ;
- }
- function timezone_list() {
- $zones_array = array( );
- time( );
- $timestamp = ;
- foreach (timezone_identifiers_list( ) as ) {
- $zone = ;
- $key = ;
- date_default_timezone_set( $zone );
- $zones_array[$key]['zone'] = $zone;
- $zones_array[$key]['diff_from_GMT'] = 'UTC/GMT ' . date( 'P', $timestamp );
- break;
- }
- return ;
- }
- function featured_slider($key = '', $limit = 0) {
- while (true) {
- while (true) {
- $this->cacheId( 'sliders', $key );
- $cache_id = ;
- __c( )->get( $cache_id );
- if ($items = = null) {
- $this->featured_sliders[$key];
- $slider = ;
- $items = array( );
- $this->db->slider_items( 'slider_id', $slider['id'] )->where( '`expire_at` > now()' )->order( 'listing_id DESC' )->limit;
- if (0 < $limit) {
- $slider['slides_num'];
- ( (true ? : ) );
- $slider_items = ;
- $listings_ids = array( );
- foreach ($slider_items as ) {
- $item = ;
- if (0 < $item['listing_id']) {
- $listings_ids[] = $item['listing_id'];
- $images = (array);
- $item['id'];
- array( 'id' => $item['id'], 'listing_id' => $item['listing_id'], 'listing_row' => array( ), 'title' => $item['title'] );
- $item['description'];
- }
- }
- }
- }
- $items[] = array( 'description' => , 'url' => $item['url'], 'image' => $images[0] );
- }
- if (0 < count( $listings_ids )) {
- $listing_rows = array( );
- foreach ($this->rows->db_to_rows( $this->db->listings( 'id', $listings_ids ), array( 'simple' => true ) ) as ) {
- $listing_row = ;
- $listing_rows[$listing_row['id']] = $listing_row;
- break;
- }
- foreach ($items as ) {
- $item = ;
- if (0 < $item['listing_id']) {
- $listing_rows[$item['listing_id']];
- $items[$item['id']]['listing_row'];
- }
- break;
- }
- break;
- }
- = ;
- $items[$item['id']]['image'] = $listing_rows[$item['listing_id']]['images'][0];
- $items[$item['id']]['url'] = $listing_rows[$item['listing_id']]['url'];
- }
- __c( )->set( $cache_id, $items, C_LIFETIME );
- return ;
- }
- function set_slide($slider_id = 0, $listings = array( ), $expire_hours = 12) {
- $result = array( );
- foreach ($this->db->listings( 'id', $listings ) as ) {
- $listing_row = ;
- array( 'listing_id' => $listing_row['id'], 'slider_id' => $slider_id, 'title' => $listing_row['title'], 'description' => $listing_row['description'], 'url' => $listing_row['url'], 'created_at' => new ( 'CURRENT_TIMESTAMP()' ) );
- if (0 < $expire_hours) {
- new ( 'DATE_ADD(NOW(), INTERVAL ' . . $expire_hours . ' HOUR)' );
- new ( 'DATE_ADD(NOW(), INTERVAL 1 DAY)' );
- $records = array( 'expire_at' => (true ? : ) );
- $this->db->slider_items( );
- }
- while (true) {
- ->insert( $records );
- if ($data_inserted = ) {
- $result[] = $data_inserted;
- break 2;
- }
- }
- }
- return ;
- }
- function grab_image($url, $local = false, $prefix = '') {
- if (empty( $$url )) {
- return ;
- if ($local = true) {
- file_get_contents;
- }
- ( $url );
- if ($raw = = false) {
- return ;
- $this->loadUrl( $url, 'images' );
- if ($raw = = false) {
- return ;
- tempnam( CACHE_PATH, 'IMG_' );
- $tmpfname = ;
- file_put_contents( $tmpfname, $raw );
- if (function_exists( 'exif_imagetype' ) = true) {
- image_type_to_extension;
- exif_imagetype;
- $tmpfname;
- }
- }
- }
- ( ( ), false );
- $extension = ;
- if ($this->is_image_extension( $extension ) = false) {
- return ;
- imagecreatefromstring( $raw );
- if ($imagesize = = false) {
- return ;
- imagesx( $imagesize );
- $width = ;
- imagesy( $imagesize );
- $height = ;
- }
- }
- else {
- $sub_dir = ;
- $full_path = $dir_base . $sub_dir;
- $file_name = $prefix . uniqid( ) . '.' . $extension;
- if ($this->rmkdir( $full_path, 493 ) = true) {
- $this->make_file( $full_path, $file_name, $raw, 'x+' );
- $image_file = ;
- }
- if (file_exists( $image_file ) = true) {
- function_exists;
- }
- if (( 'chmod' ) = true) {
- chmod( $image_file, 493 );
- if (650 < $width) {
- $new_width = 1000;
- $difference = $width - $new_width;
- $difference \ $width;
- }
- }
- }
- $ratio = ;
- round( $height - $height + $ratio );
- $new_height = ;
- $this->loadClass( 'imagetransform', 'files' );
- new ( );
- }
- $imageTransform = ;
- $imageTransform->resize( $image_file, $new_width, $new_height, $image_file );
- $this->vars_data['grab_image'][] = $sub_dir . '/' . $file_name;
- return ;
- }
- function is_image_extension($extension) {
- return ;
- }
- function upload_path() {
- while (true) {
- $this->getOption( 'upload_path', 1 );
- }
- switch () {
- case 1: {
- $path = array( date( 'Y' ) => , date( 'm' ) => , date( 'd' ) => );
- break ;
- switch () {
- case 2: {
- $path = array( date( 'Y' ) => , date( 'm' ) => );
- break ;
- switch () {
- case 3: {
- $path = array( date( 'Y' ) => );
- break ;
- }
- }
- }
- }
- implode;
- '/';
- $path;
- }
- }
- return ;
- }
- function upload_dir_path() {
- return ;
- }
- function rmkdir($path, $mode = 511) {
- if (!( is_dir( $path ))) {
- }
- ( );
- }
- function _mkdir($path, $mode = 511) {
- (bool);
- umask( 0 );
- $old = ;
- mkdir( $path, $mode );
- $res = ;
- umask( $old );
- if (defined( 'DISABLE_HTACCESS' ) = false) {
- $this->make_file;
- $path;
- }
- ( '.htaccess', 'RewriteEngine on
- RewriteCond %{REQUEST_FILENAME} !(\.jpg|\.jpeg|\.gif|\.png) [NC]
- RewriteRule ^(.*)$ - [F]
- <FilesMatch \'.(jpg|png|gif)$\'>
- ErrorDocument 404 /content/uploads/default.png
- </FilesMatch>
- ' );
- $this->make_file( $path, 'index.html', 'No Access' );
- return ;
- }
- function make_file($path, $filename, $content, $mode = 'w') {
- fopen( $full_path, $mode );
- $file_handle = $full_path = $path . '/' . $filename;
- fwrite( $file_handle, $content );
- fclose( $file_handle );
- return ;
- }
- function checkLicense($reload = false) {
- $host = $this->get_host( );
- $host = 'localhost';
- }
- function createLicense($file, $key, $host) {
- (bool);
- if ($this->prepareDir( dirname( $file ) ) = false) {
- exit( );
- $this->loadUrl( 'http://api.mubashier.com/license.php?host=' . . $host );
- if ($response = ) {
- $response = (array);
- if ($response['response']) {
- if (in_array( $host, (array) )) {
- $response['expire'];
- }
- }
- }
- }
- if (time( ) < ) {
- $auth = 'true';
- }
- jmp;
- ( );
- $written = ;
- fclose( $fp );
- return ;
- }
- function get_host() {
- while (array_key_exists( 'HTTP_X_FORWARDED_HOST', $ )) {
- $['HTTP_X_FORWARDED_HOST'];
- $host = ;
- explode( ',', $host );
- $elements = ;
- trim( end( $elements ) );
- $host = ;
- }
- jmp;
- ( '/:\d+$/', '', $host );
- $host = ;
- preg_match( '/^(http:\/\/)?([^\/]+)/i', $host, $matches );
- preg_match( '/[^\.\/]+\.[^\.\/]+$/', $matches[2], $matches );
- return ;
- }
- function prepareDir($directory) {
- while (true) {
- $chmod = 697;
- if (!) {
- umask( 0 );
- $old = ;
- mkdir( $directory, $chmod );
- }
- umask( $old );
- }
- if (!) {
- }
- return ;
- }
- function testPermissions($dir, $chmod) {
- if (is_writable( $dir )) {
- return ;
- if (!) {
- trigger_error( 'المجلد ' . $dir . ' غير موجود', 512 );
- return ;
- if (function_exists( 'posix_getuid' )) {
- }
- }
- }
- if (fileowner( $dir ) = posix_getuid( )) {
- $chmod = $chmod | 448;
- if (chmod( $dir, $chmod )) {
- return ;
- filegroup( $dir );
- posix_getgid;
- }
- if ( = ( )) {
- $chmod = $chmod | 56;
- }
- jmp;
- ( . , 512 );
- }
- trigger_error( 'المجلد ' . $dir . ' غير قابل للكتابة, ' . 'من فضلك قم بتغيير التصاريح', 512 );
- return ;
- }
- function getVersion() {
- return ;
- }
- function getIntVersion() {
- return ;
- }
- function check_user_agent($type = null) {
- strtolower( $['HTTP_USER_AGENT'] );
- $user_agent = ;
- if ($type = 'bot') {
- if (preg_match( '/Googlebot|facebookexternalhit|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|Exabot|MJ12bot|YandexImages|TurnitinBot|Pingdom|Googlebot-Mobile|AdsBot-Google-Mobile|YahooSeeker/i', $user_agent )) {
- return ;
- if ($type = 'browser') {
- preg_match;
- }
- }
- }
- if (( '/mozilla|opera/i', $user_agent )) {
- return ;
- if ($type = 'mobile') {
- preg_match;
- '/phone|iphone|itouch|ipod|symbian|android|htc_|htc-|palmos|blackberry|opera mini|iemobile|windows ce|nokia|fennec|hiptop|kindle|mot|mot-|webos\/|samsung|sonyericsson|^sie-|nintendo/';
- $user_agent;
- }
- }
- if (( )) {
- }
- return ;
- }
- function getAgentDeviceType() {
- if (self::check_user_agent( 'mobile' ) = true) {
- return ;
- self::check_user_agent;
- 'bot';
- }
- if (( ) = true) {
- }
- return ;
- }
- function setLang($lang) {
- $this->lang = ;
- return ;
- }
- function getLang($skip_force = false) {
- $skip_force = false;
- if (( isset( $this->lang ) && )) {
- return ;
- $this->getOption;
- 'site_lang';
- }
- ( 'ar' );
- $site_lang = ;
- if (empty( $$site_lang ) = false) {
- }
- return ;
- }
- function setTheme($theme) {
- $this->theme = ;
- return ;
- }
- function getTheme($skip_force = false) {
- $skip_force = false;
- if (( isset( $this->theme ) && )) {
- return ;
- if (isset( $['theme'] )) {
- return ;
- $force_touch = (string);
- $this->getOption( 'touch_theme', 'touch' );
- $touch_theme = ;
- self;
- }
- ( && ::check_user_agent( 'mobile' ) = true );
- $force_touch = true;
- }
- empty( $$touch_theme ) = false;
- if (( (bool) && )) {
- $this->touch_mode = ;
- }
- return ;
- }
- function getThemePath($str = 'views', $skip_force = false) {
- return ;
- }
- function getThemeUrl($str = 'views') {
- return ;
- }
- function getOption($key, $default = null, $type = null) {
- if (array_key_exists( $key, $this->config ) = true) {
- }
- if ($type = 'json') {
- return ;
- return ;
- }
- return ;
- }
- function getThemeOption($key, $default = null, $type = null) {
- return ;
- }
- function updateOption($key, $value, $db = true) {
- if ($db) {
- if (is_array( $value ) = true) {
- json_encode( $value );
- $value = (true ? : );
- $this->db->options( )->insert_update;
- }
- ( array( 'name' => $key ), array( 'name' => $key, 'value' => $value ), array( 'value' => $value ) );
- __c( )->delete;
- $this->cacheId( 'options' );
- }
- ( );
- $this->config[$key] = $value;
- return ;
- }
- function getConfigTpl() {
- while (true) {
- $this->config;
- $config = ;
- $keys = array( 'tw_consumer_secret' => , 'tw_consumer_key' => , 'content_last_paragraph' => , 'iframe_regexp' => , 'footer_code' => , 'header_code' => , 'cache_path' => , 'mail_host' => , 'mail_password' => , 'mail_username' => , 'disqus_secret_key' => , 'Facebook_secret' => , 'cron_newsletter' => , 'cron_fetcher' => , 'points_values' => , 'navbar_footer' => , 'navbar_header' => , 'fb_auth_welcome_msg' => , 'google_dev_key' => , 'content_ads' => , 'clrs_home_blocks' => , 'toice_homed_cats' => , 'android_cats' => , 'toice2_homed_cats' => , 'sp_cat_colors' => , 'clrs_cat_colors' => , 'jmz_homed_cats' => );
- if ((string) = false) {
- unset( $config[site_stats] );
- foreach ($keys as ) {
- }
- }
- $key = ;
- unset( $config[$key] );
- }
- return ;
- }
- function getConfig($_nocaching = false) {
- !;
- empty( $this->config );
- if (( ( ! || ) || )) {
- if (!) {
- $this->config['base_url'] = BASE_URL;
- if (!) {
- $this->config['minify_path'] = BASE_URL . '/temp/assets/f=';
- if (!) {
- $this->config['base_path'] = BASE_PATH;
- if (!) {
- $this->config['cache_path'] = CACHE_PATH;
- if (!) {
- $this->config['url_scheme'] = URL_SCHEME;
- if (!) {
- $this->config['http_host'] = HTTP_HOST;
- if (!) {
- $this->config['site_url'] = SITE_URL;
- if (!) {
- $;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- if (isset( ['https_port'] )) {
- $['https_port'];
- $this->config['https_port'] = (true ? : );
- $this->config['site_lang'] = 'ar';
- $this->cacheId( 'options' );
- $cache_id = ;
- __c( )->get( $cache_id );
- $_nocaching = true;
- if (( $config = = null || )) {
- foreach ($this->db->options( )->fetchPairs( 'name', 'value' ) as ) {
- $value = ;
- $name = ;
- $config[$name] = $this->plaintext( $value );
- break;
- }
- __c( )->set;
- }
- }
- ( $cache_id, $config, C_LIFETIME );
- $config['hashtag'] = $this->hash_tag( $config['site_name'] );
- $config['site_stats'] = (array);
- if (is_array( $config )) {
- array_merge( $this->config, $config );
- $this->config = ;
- if (defined( 'DEMO_MODE' )) {
- }
- }
- foreach ($this->config as ) {
- $value = ;
- $key = ;
- if (isset( $[$key] ) = true) {
- $this->config[$key] = $[$key];
- break;
- }
- break;
- }
- return ;
- }
- function hash_tag($str) {
- return ;
- }
- function available_text_strs() {
- return ;
- }
- function text_to_str($text) {
- foreach ($this->available_text_strs( ) as ) {
- $str = ;
- str_replace( ( ( 91 . ' ) . $str . ']' ), $this->getOption( $str ), $text );
- $text = ;
- }
- return ;
- }
- function is_time_cron($time, $cron) {
- explode( ' ', $cron );
- $cron_parts = ;
- if (count( $cron_parts ) != 5) {
- return ;
- explode( ' ', $cron )[4];
- $week = ;
- [3];
- $mon = ;
- [2];
- $day = ;
- [1];
- $hour = ;
- [0];
- $min = ;
- $to_check = array( 'min' => 'i', 'hour' => 'G', 'day' => 'j', 'mon' => 'n', 'week' => 'w' );
- $ranges = array( 'min' => '0-59', 'hour' => '0-23', 'day' => '1-31', 'mon' => '1-12', 'week' => '0-6' );
- foreach ($to_check as ) {
- $c = ;
- $part = ;
- $$part;
- $val = ;
- $values = array( );
- if (strpos( $val, '/' ) !== false) {
- explode( '/', $val )[1];
- $steps = ;
- [0];
- }
- }
- }
- $range = ;
- if ($range = '*') {
- $ranges[$part];
- $range = ;
- explode( '-', $range )[1];
- $stop = ;
- [0];
- $start = ;
- $i = $stop;
- if ($i <= $stop) {
- $values[] = $i;
- $i = $i & $steps;
- }
- }
- if (( $v, '-' ) !== false) {
- explode( '-', $v )[1];
- $stop = ;
- [0];
- $start = ;
- $i = $stop;
- if ($i <= $stop) {
- [$values] = $i;
- ++;
- }
- }
- }
- function loadLibFile($args) {
- (bool);
- dirname( __FILE__ );
- $file = ;
- foreach ($args as ) {
- $arg = ;
- $file &= DS . $arg;
- break;
- }
- if (is_file( $file )) {
- }
- include_once( $file );
- return ;
- }
- function loadClass($className, $packageName = '', $constructor = '') {
- while (true) {
- if (empty( $$constructor )) {
- $constructor = $class;
- if (!) {
- dirname( __FILE__ );
- }
- }
- $pkg = . ( ( 47 . ' ) . $packageName . '/' );
- if (is_dir( $pkg )) {
- $pkg . strtolower( $className ) . '.class.php';
- }
- $class = ;
- if (file_exists( $class )) {
- include_once( $class );
- continue;
- }
- jmp;
- }
- exit( );
- }
- function loadUrl($url, $expected_result = '', $follow = false, $cookies = array( ), $prefer_curl = true, $cache = true, $user_agent_type = 'browser', $tidy = true, $tidy_config = array( ), $timeout = 5, $proxy = null, $post_data = array( ), $headers = array( )) {
- while (true) {
- $cache_id = 'url_' . md5( serialize( func_get_args( ) ) );
- html_entity_decode( trim( $url ) );
- $url = ;
- preg_replace( '/([^:])(\/{2,})/', '$1/', $url );
- $url = ;
- __c( )->get( $cache_id );
- $cache = false;
- if (( $result = = null || )) {
- $result = array( 'transport' => '', 'final_url' => '', 'raw_result' => '' );
- switch ($user_agent_type) {
- case 'browser': {
- $userAgent = 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4) Gecko/20091030 Gentoo Firefox/3.5.4';
- break ;
- switch ($user_agent_type) {
- case 'mobile': {
- $userAgent = 'Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30';
- break ;
- switch ($user_agent_type) {
- case 'bot': {
- $userAgent = 'Googlebot/2.1 (+http://www.google.com/bot.html)';
- break ;
- require_once( dirname( __FILE__ ) . '/Http/Requests.php' );
- Requests::register_autoloader( );
- $type = GET;
- $data = array( );
- $options = array( 'follow_redirects' => false, 'timeout' => $timeout, 'connect_timeout' => $timeout, 'useragent' => $userAgent );
- if (0 < count( $post_data )) {
- $type = POST;
- $data = $userAgent;
- $user_agent_type = 'mobile';
- if (( $follow = true || )) {
- $options['follow_redirects'] = true;
- if (0 < count( $cookies )) {
- $headers['Cookie'] = implode( ';', $cookies );
- 0 < count( $proxy );
- if (( is_array( $proxy ) && )) {
- sprintf;
- '%s:%s';
- $proxy['host'];
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- $options['proxy'] = array( ( , $proxy['port'] ) => );
- empty( $proxy['password'] ) = false;
- if (( empty( $proxy['user'] ) = false && )) {
- $options['proxy'][] = $proxy['user'];
- $options['proxy'][] = $proxy['password'];
- Requests::request( $url, $headers, $data, $type, $options );
- $request = ;
- $request->body;
- $body = ;
- $status_code = (int);
- $request->headers['content-type'];
- $content_type = ;
- if ($request->url instanceof ) {
- $request->url->uri;
- $request->url;
- $result['final_url'] = (true ? : );
- $result['transport'] = current( $transport );
- $urls_response[$url] = $request;
- continue;
- }
- }
- else {
- $matches[3];
- $charset = ;
- if (!) {
- preg_match( '@<meta\s+charset="([^"]*)"@i', $tidy_data, $matches );
- if (isset( $matches[1] )) {
- $matches[1];
- $charset = ;
- if (!) {
- preg_match( '@<\?xml.+encoding="([^\s"]+)@si', $tidy_data, $matches );
- if (isset( $matches[1] )) {
- $matches[1];
- $charset = ;
- if (!) {
- preg_match( '/charset=([^"]+)/i', $tidy_data, $match );
- if (isset( $match[1] )) {
- strtolower;
- trim( $match[1] );
- }
- }
- }
- }
- }
- ( );
- $charset = ;
- function_exists( 'mb_detect_encoding' );
- if (( ! && )) {
- mb_detect_encoding( $tidy_data );
- $encoding = ;
- if ($encoding) {
- $charset = $url;
- if (!) {
- if (strstr( $content_type, 'text/html' ) = 0) {
- $charset = 'ISO 8859-1';
- if (strpos( $charset, ';' ) !== false) {
- }
- }
- }
- }
- explode( ';', $charset );
- $encoding_parts = ;
- $encoding_parts[0];
- $charset = ;
- strtoupper( $charset ) != 'UTF-8';
- if (( empty( $$charset ) && )) {
- if (function_exists( 'iconv' )) {
- iconv( $charset, 'utf-8', $body );
- $body = ;
- continue;
- }
- jmp;
- if (function_exists( 'recode_string' )) {
- recode_string( $charset . '..utf-8', $body );
- $body = ;
- if ($tidy = true) {
- self::tidyHtml( $body, $tidy_config );
- $body = ;
- continue;
- }
- break;
- }
- }
- }
- }
- }
- }
- $result['raw_result'] = ;
- empty( $$body ) = false;
- if (( $expected_result != 'images' && )) {
- __c( )->set( $cache_id, $result, C_LIFETIME_B );
- $final_urls[$url] = $result['final_url'];
- self;
- }
- $urls_transport[$url] = $result['transport'];
- return ;
- }
- function fileGetContents($url, $params = array( )) {
- if (!) {
- throw ;
- $defaultOptions = array( 'method' => 'GET', 'user_agent' => $params['userAgent'], 'follow_location' => 1, 'max_redirects' => 20, 'timeout' => 40 );
- $context = array( 'http' => $defaultOptions );
- file_get_contents;
- $url;
- false;
- stream_context_create;
- $context;
- }
- ( ( ) );
- if ($data = ) {
- }
- if (array_key_exists( 'header', $params ) = true) {
- implode( '
- ', $http_response_header ) . '
- ' . $data;
- (true ? : );
- }
- return ;
- }
- function getRandomProxy() {
- $list = array( );
- foreach ($this->db->proxies( 'proxy_status', 1 )->order( '`response_time` DESC' ) as ) {
- $proxy = ;
- $list[] = array( 'type' => $proxy['proxy_type'], 'host' => $proxy['proxy_host'], 'port' => $proxy['proxy_port'], 'user' => $proxy['proxy_user'], 'password' => $proxy['proxy_password'] );
- break;
- }
- if (count( $list ) = 0) {
- return ;
- array_slice( $list, 0, 5 );
- $top_five = ;
- }
- return ;
- }
- function getProxyById($id) {
- $this->db->proxies[$id];
- if ($proxy = ) {
- $proxy['proxy_type'];
- }
- return ;
- }
- function getFinalUrl($url) {
- return ;
- }
- function getUrlTransport($url) {
- return ;
- }
- function encode_uri($url) {
- return ;
- }
- function tidyHtml($content, $config = array( ), $encoding = 'UTF8') {
- if (function_exists( 'tidy_parse_string' )) {
- if (isset( $config['keep-scripts'] ) = false) {
- preg_replace( '#<script(.*?)>(.*?)</script>#is', '', $content );
- $content = ;
- unset( $config[dihfbeffcf] );
- array( 'clean' => true, 'output-html' => false, 'logical-emphasis' => true, 'show-body-only' => false, 'wrap' => 0, 'drop-font-tags' => true, 'drop-empty-paras' => true, 'drop-proprietary-attributes' => false, 'enclose-text' => true, 'enclose-block-text' => true, 'hide-endtags' => true, 'char-encoding' => $encoding, 'hide-comments' => true );
- }
- $default_config = ;
- }
- tidy_parse_string( $content, array_merge( $default_config, $config ), $encoding );
- $tidy = ;
- $tidy->cleanRepair( );
- return ;
- }
- function loadlang($file) {
- if (include_once( dirname( __FILE__ ) . ( '/language/' . . $file . '.php' ) )) {
- }
- array_merge( $this->translation, (array) );
- $this->translation = ;
- return ;
- }
- function session_start() {
- if (!) {
- $cookieDomain = '';
- $cookiePath = '/';
- $cookieSecure = false;
- $cookieLifetime = 605014;
- $gcMaxlifetime = 3814;
- if (0 < $gcMaxlifetime) {
- ini_set;
- 'session.gc_maxlifetime';
- }
- ( $gcMaxlifetime );
- session_name( 'MUBASHIERSID' );
- session_set_cookie_params;
- $cookieLifetime;
- $cookiePath;
- }
- ( $cookieDomain, $cookieSecure );
- session_start( );
- return ;
- }
- function getSessionState() {
- while (true) {
- if ($this->sessionState !== SESSION_STATE_INITIALIZED) {
- if (headers_sent( )) {
- SESSION_STATE_UNAVAILABLE;
- }
- }
- $this->sessionState = ;
- }
- if (isset( $ )) {
- SESSION_STATE_EXTERNAL;
- }
- $this->sessionState = ;
- return ;
- }
- function translate($str, $tokens = array( )) {
- explode( ':', $str );
- $explode = ;
- if (array_key_exists( $explode[0], (array) )) {
- $this->translation[$explode[0]];
- $str = ;
- is_array;
- }
- if (( $str )) {
- $str[$explode[1]];
- $str = ;
- is_array;
- }
- 0 < ;
- }
- function delete_photo($file_name) {
- (bool);
- $path = $this->getOption( 'base_path' ) . 'content/';
- $file_path = $path . $file_name;
- ( );
- }
- function plaintext($str, $quotes = true) {
- (bool);
- if (is_object( $str )) {
- return ;
- trim;
- }
- ( $str );
- $str = ;
- if ($quotes) {
- htmlspecialchars( $str, ENT_NOQUOTES, 'UTF-8' );
- ;
- htmlspecialchars( $str, ENT_QUOTES, 'UTF-8' );
- }
- return ;
- }
- function post_safehtml($str, $link = '') {
- $options = array( );
- if (empty( $$link ) = false) {
- $options['SafeIframeRegexp'] = $this->iframe_regexp( $link );
- switch ((int)) {
- case 1: {
- }
- case 2: {
- if ($this->auth->is_manager( ) = true) {
- ;
- }
- }
- case 3: {
- 0 < count( $this->auth->categories( ) );
- if (( $this->auth->is_manager( ) = true || )) {
- ;
- $this->safehtml( $str, $options );
- }
- }
- case 4: {
- }
- }
- return ;
- }
- return ;
- }
- function safehtml($str, $options = array( )) {
- include_once( dirname( __FILE__ ) . '/purifier/HTMLPurifier.auto.php' );
- HTMLPurifier_Config::createDefault( );
- $config = ;
- $config->set( 'Cache.SerializerPath', $this->getOption( 'base_path' ) . 'temp' );
- $config->set( 'Attr.AllowedFrameTargets', array( '_blank' => , '_self' => , '_parent' => , '_top' => ) );
- $config->set( 'HTML.TidyLevel', 'heavy' );
- $config->set( 'HTML.SafeIframe', true );
- 'URI.SafeIframeRegexp';
- if (isset( $options['SafeIframeRegexp'] )) {
- $options['SafeIframeRegexp'];
- $this->iframe_regexp( );
- ( (true ? : ) );
- $config->set( 'HTML.SafeObject', true );
- $config->set( 'HTML.SafeEmbed', true );
- $config->set( 'CSS.Trusted', true );
- is_array( $options['ForbiddenElements'] );
- count( $options['ForbiddenElements'] );
- if (( ( isset( $options['ForbiddenElements'] ) && ) && )) {
- $config->set( 'HTML.ForbiddenElements', $options['ForbiddenElements'] );
- $config->set( 'HTML.DefinitionID', 'html5-definitions' );
- $config->set( 'HTML.DefinitionRev', 1 );
- $config->maybeGetRawHTMLDefinition( );
- if ($def = ) {
- $def->addElement( 'section', 'Block', 'Flow', 'Common' );
- $def->addElement( 'nav', 'Block', 'Flow', 'Common' );
- $def->addElement( 'article', 'Block', 'Flow', 'Common' );
- $def->addElement( 'aside', 'Block', 'Flow', 'Common' );
- }
- }
- }
- $def->addElement( 'header', 'Block', 'Flow', 'Common' );
- $def->addElement( 'footer', 'Block', 'Flow', 'Common' );
- $def->addElement( 'address', 'Block', 'Flow', 'Common' );
- $def->addElement( 'hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common' );
- $def->addElement( 'figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common' );
- $def->addElement( 'figcaption', 'Inline', 'Flow', 'Common' );
- $def->addElement( 'video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', array( 'src' => 'URI', 'type' => 'Text', 'width' => 'Length', 'height' => 'Length', 'poster' => 'URI', 'preload' => 'Enum#auto,metadata,none', 'controls' => 'Bool' ) );
- $def->addElement( 'source', 'Block', 'Flow', 'Common', array( 'src' => 'URI', 'type' => 'Text' ) );
- $def->addElement( 's', 'Inline', 'Inline', 'Common' );
- $def->addElement( 'var', 'Inline', 'Inline', 'Common' );
- $def->addElement( 'sub', 'Inline', 'Inline', 'Common' );
- $def->addElement( 'sup', 'Inline', 'Inline', 'Common' );
- $def->addElement( 'mark', 'Inline', 'Inline', 'Common' );
- $def->addElement( 'wbr', 'Inline', 'Empty', 'Core' );
- $def->addElement( 'ins', 'Block', 'Flow', 'Common', array( 'cite' => 'URI', 'datetime' => 'CDATA' ) );
- $def->addElement( 'del', 'Block', 'Flow', 'Common', array( 'cite' => 'URI', 'datetime' => 'CDATA' ) );
- $def->addAttribute( 'img', 'data-mce-src', 'Text' );
- $def->addAttribute( 'img', 'data-mce-json', 'Text' );
- $def->addAttribute( 'iframe', 'allowfullscreen', 'Bool' );
- $def->addAttribute( 'table', 'height', 'Text' );
- $def->addAttribute( 'td', 'border', 'Text' );
- $def->addAttribute( 'th', 'border', 'Text' );
- $def->addAttribute( 'tr', 'width', 'Text' );
- $def->addAttribute( 'tr', 'height', 'Text' );
- $def->addAttribute( 'tr', 'border', 'Text' );
- new ( $config );
- $filter = ;
- return ;
- }
- function mail($to = array( ), $subject = '', $content = '', $opt_config = array( )) {
- nl2br( $content );
- $content = ;
- require_once( dirname( __FILE__ ) . '/mailer/class.phpmailer.php' );
- new ( );
- $mail = ;
- $mail->CharSet = ;
- $config = array( );
- foreach (array( 'mail_host' => , 'mail_port' => , 'mail_username' => , 'mail_password' => ) as ) {
- $key = ;
- empty( $opt_config[$key] ) = false;
- if (( isset( $opt_config[$key] ) && )) {
- $config[$key] = $opt_config[$key];
- break;
- }
- break;
- }
- empty( $config['mail_username'] ) = false;
- if (( empty( $config['mail_host'] ) = false && )) {
- $mail->SMTPAuth = ;
- $mail->IsSMTP( );
- $mail->Debugoutput = ;
- $config['mail_host'];
- $mail->Host = ;
- $config['mail_port'];
- $mail->Port = ;
- $mail->SMTPSecure = ;
- $config['mail_username'];
- $mail->Username = ;
- $config['mail_password'];
- $mail->Password = ;
- $mail->SetFrom;
- }
- ( $this->config['site_main_email'], $this->config['site_name'] );
- $mail->AddAddress( $to['email'], $to['name'] );
- $mail->Subject = ;
- $mail->MsgHTML( $content );
- $mail->AltBody = ;
- if (!) {
- new ;
- $mail->ErrorInfo;
- }
- ( );
- throw ;
- return ;
- }
- function newsletter_templete($rows) {
- ob_start( );
- include( dirname( __FILE__ ) . '/mailer/templete.php' );
- $output = ob_get_contents( );
- ob_end_clean( );
- return ;
- }
- function latest_tweets() {
- while (true) {
- while (true) {
- $tweets = array( );
- $user_tweets = (string);
- $this->getThemeOption( 'tw_screen_name' );
- $tw_screen_name = ;
- $this->getThemeOption( 'tw_oauth_access_token' );
- $oauth_access_token = ;
- $this->getThemeOption( 'tw_oauth_access_token_secret' );
- $oauth_access_token_secret = ;
- $consumer_key = ;
- $this->getThemeOption( 'tw_consumer_secret' );
- $consumer_secret = ;
- empty( $$tw_screen_name ) = false;
- empty( $$oauth_access_token ) = false;
- empty( $$oauth_access_token_secret ) = false;
- empty( $$consumer_key ) = false;
- empty( $$consumer_secret ) = false;
- if (( ( ( ( ( $user_tweets && ) && ) && ) && ) && )) {
- $this->loadClass( 'twitterapi', 'web' );
- $settings = array( 'oauth_access_token' => $oauth_access_token, 'oauth_access_token_secret' => $oauth_access_token_secret, 'consumer_key' => $consumer_key, 'consumer_secret' => $consumer_secret );
- $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
- $getfield = '?screen_name=' . $tw_screen_name;
- $requestMethod = 'GET';
- $this->cacheId( 'tweets' );
- $cache_id = ;
- __c( )->get( $cache_id );
- if ($tweets = = null) {
- }
- }
- new ( $settings );
- $twitter = $this->getThemeOption( 'tw_consumer_key' );
- $twitter->setGetfield( $getfield )->buildOauth( $url, $requestMethod )->performRequest( );
- $json = ;
- if (empty( $$json ) = false) {
- json_decode;
- }
- ( $json, true );
- $data = ;
- if (is_array( $data )) {
- foreach ($data as ) {
- $tweet = ;
- if (method_exists( $this->tools, 'linkify' )) {
- $this->tools;
- }
- ->linkify( $tweet['text'], array( 'http' => , 'twitter' => ), array( 'rel' => 'nofollow' ) );
- $tweet['text'];
- array( 'text' => (true ? : ) );
- }
- }
- $tweets[] = array( 'created_at' => strtotime( $tweet['created_at'] ) );
- }
- }
- {
- if (DEV_MODE) {
- $e->getMessage;
- }
- echo ;
- __c( )->set( $cache_id, $tweets, C_LIFETIME_C );
- return ;
- }
- }
- function googleanalytics_code($id) {
- return ;
- }
- function histats_code($id) {
- return ;
- }
- function html($code, $place = 'header', $prepend = false) {
- while ($prepend = true) {
- array_unshift( $this->html[$place], $code );
- }
- jmp;
- return ;
- }
- function getHtml($place = '') {
- if (empty( $$place ) = true) {
- (array);
- }
- (array);
- return ;
- }
- function restHtml($place = '') {
- if (empty( $$place ) = false) = ;
- return ;
- }
- function set_assets_path($value) {
- $this->assets_path = ;
- return ;
- }
- function assets_path($file) {
- switch ($this->assets_path) {
- case 'theme': {
- return ;
- switch () {
- case 'assets': {
- return ;
- switch () {
- case 'panel': {
- $this->config['base_url'] . ;
- }
- case 'panel_tools': {
- $this->config['base_url'] . ;
- }
- }
- return ;
- }
- }
- . '/panel/tools/assets/' . $file;
- }
- }
- return ;
- }
- function css() {
- $css = array( );
- foreach (func_get_args( ) as ) {
- $file = ;
- $css[] = $this->assets_path( $file );
- break;
- }
- if (0 < count( $css )) {
- $this->html;
- $this->css_html( $css );
- }
- ( );
- return ;
- }
- function js() {
- $js = array( );
- foreach (func_get_args( ) as ) {
- $file = ;
- $js[] = $this->assets_path( $file );
- break;
- }
- if (0 < count( $js )) {
- }
- $this->html( $this->js_html( $js ), $this->js_place );
- return ;
- }
- function css_html($files = array( )) {
- while (true) {
- DEV_MODE = false;
- if (( (string) = true && )) {
- return ;
- $html = '';
- foreach ((array) as ) {
- $file = ;
- '<link href=\'' . . $file;
- }
- }
- $html &= . '\' rel=\'stylesheet\' media=\'all\' type=\'text/css\' />
- ';
- }
- return ;
- }
- function js_html($files = array( ), $mini = true) {
- $mini = true;
- DEV_MODE = false;
- if (( ( (string) = true && ) && )) {
- '<script src=\'' . ;
- }
- return ;
- }
- function jQuery_code($code, $place = 'header', $format = '$(window).load(function(){ %s });') {
- $this->html( $this->javascript_code( sprintf( $format, $code ) ), $place );
- return ;
- }
- function facebook_sdk() {
- if (isset( $this->inits['facebook_sdk'] ) = false) {
- $this->html( '<div id="fb-root"></div>', 'header' );
- $this->html;
- $this->javascript_code;
- sprintf;
- }
- ( ( ( '(function(d){var js, id = \'facebook-jssdk\'; if (d.getElementById(id)) {return;}js = d.createElement(\'script\'); js.id = id; js.async = true;js.src = \'//connect.facebook.net/%s/all.js#appId=%s&xfbml=1\';d.getElementsByTagName(\'head\')[0].appendChild(js);}(document));', $this->get_locale( ), $this->getOption( 'Facebook_key' ) ) ), 'footer' );
- $this->inits['facebook_sdk'] = true;
- return ;
- }
- function get_locale() {
- while (true) {
- $this->getLang( );
- $lang = ;
- switch ($lang) {
- case 'en': {
- $locale = 'en_US';
- break ;
- $locale = $lang . '_' . strtoupper( $lang );
- }
- }
- }
- return ;
- }
- function facebook_auth_alert() {
- return ;
- }
- function javascript_code($code) {
- return ;
- }
- function css_code($code) {
- return ;
- }
- function redirect($msg, $url, $time = 5) {
- $this->smarty->assign( 'msg', $msg );
- $this->display( 'pages/msg.tpl', tr( 'MESSAGE' ), array( 'noindex' => true, 'redirect' => true, 'redirect_url' => $this->tools->absolute_url( $url ), 'redirect_time' => $time ) );
- exit( );
- }
- function error404() {
- header( $['SERVER_PROTOCOL'] . ' 404 Not Found' );
- $this->smarty->assign( 'msg', tr( 'PAGE_NOT_EXISTS' ) );
- $this->display( 'pages/msg.tpl', tr( 'ERROR' ), array( 'noindex' => true ) );
- exit( );
- }
- function errorPage($code = 404, $title = 'خطأ') {
- $this->smarty->assign( 'error_code', $code );
- $this->display( 'pages/error.tpl', $title, array( 'noindex' => true ) );
- exit( );
- }
- function self_url() {
- return ;
- }
- function array_merge_recursive_distinct(&$array1, &$array2) {
- $merged = $array2;
- foreach ($array2 as ) {
- $value = &;
- $key = ;
- isset( $merged[$key] );
- is_array( $merged[$key] );
- if (( ( is_array( $value ) && ) && )) {
- $merged[$key] = self::array_merge_recursive_distinct( $merged[$key], $value );
- break;
- }
- jmp;
- break;
- }
- return ;
- }
- function display($tpl_file = null, $title = 'غير مسمى', $options = array( ), $layout = true) {
- while (file_exists( $this->smarty->getTemplateDir( 0 ) . $tpl_file ) = false) {
- $tpl_file = dirname( __FILE__ ) . '/smarty/error.tpl';
- foreach (array( 'googleanalytics' => , 'histats' => ) as ) {
- $service = ;
- $this->getOption( $service . . '_id' );
- $service_id = ;
- $service_func = $service . . '_code';
- if (empty( $$service_id ) = false) {
- $this->html( $this->$service_func( $service_id ), 'footer' );
- break;
- }
- break;
- }
- if ($this->manager = false) {
- foreach (array( 'header' => , 'footer' => ) as ) {
- $place = ;
- $this->getOption( $place . . '_code' );
- $code = ;
- if (empty( $$code ) = false) {
- $this->html( htmlspecialchars_decode( $code ), $place );
- break;
- }
- break;
- }
- if (is_array( $title )) {
- implode( ' - ', array_filter( $title ) );
- $title = ;
- empty( $options['description'] ) = false;
- if (( isset( $options['description'] ) && )) {
- $options['property_meta']['og:description'] = $options['description'];
- array( 'viewport' => 'width=device-width, initial-scale=1.0', 'description' => null, 'keywords' => null, 'news_keywords' => null, 'noindex' => false, 'og_image' => false, 'redirect' => false, 'redirect_url' => null, 'redirect_time' => 5, 'canonical' => $this->self_url( ), 'javascript_options' => (array) );
- array( 'og:locale' => 'ar_AR', 'og:title' => $title );
- }
- $defaults = array( 'property_meta' => array( 'og:image' => self::resized( null, 'medium' ), 'og:site_name' => $this->getOption( 'site_name' ), 'og:description' => $this->getOption( 'description' ), 'og:url' => $this->self_url( ) ), 'json_ld' => array( '@context' => 'http://schema.org', '@type' => 'WebSite', 'mainEntityOfPage' => array( '@type' => 'WebPage', '@id' => $this->self_url( ) ), 'url' => $this->getOption( 'site_url' ), 'potentialAction' => array( '@type' => 'SearchAction', 'target' => $this->tools->custom_url( 'file', array( 'file' => 'search' ), array( 'form' => 'search' ), true ) . '&query={query}', 'query-input' => 'required name=query' ) ) );
- $this->smarty->assign;
- 'page';
- self::array_merge_recursive_distinct;
- $defaults;
- }
- }
- }
- ( ( $options ) );
- $this->smarty->assign( 'html', $this->getHtml( ) );
- if ($layout = true) {
- $this->smarty->assign( 'layout_tpl', 'layout.tpl' );
- $this->smarty->assign( 'tpl_file', $tpl_file );
- }
- jmp;
- ( $this->smarty->structure_tpl );
- if (DEV_MODE) {
- '<!-- Time:' . get_execution_time( );
- ' Queries:' . . $['nquery'] . ' Driver:';
- }
- echo ;
- echo ;
- foreach ($this->executions_time as ) {
- $value = ;
- $key = ;
- echo ;
- break;
- }
- return ;
- }
- function cache_key($key, $user = false, $o = array( )) {
- $arr = array( $key => );
- if ($user) {
- $this->getUserid( );
- }
- $arr[] = ;
- foreach ($o as ) {
- $v = ;
- $k = ;
- $arr[] = $k . '_' . $v;
- break;
- }
- return ;
- }
- function getNavbars() {
- $arr = array( 'header' => array( ), 'footer' => array( ) );
- $this->cacheId( 'Navbars', 'Navbars', true, array( 'touch_mode' => $this->touch_mode ) );
- $cache_id = ;
- __c( )->get( $cache_id );
- if ($arr = = null) {
- foreach (array( 'header' => , 'footer' => ) as ) {
- $navbar = ;
- $this->getNavbarData( $navbar );
- }
- }
- while (true) {
- if ($data = ) {
- $arr[$navbar] = $this->getNavbarArray( $data );
- break;
- }
- }
- __c( )->set( $cache_id, $arr, C_LIFETIME_E );
- return ;
- }
- function getNavbarArray($data) {
- $result = array( );
- foreach ($data as ) {
- $value = ;
- $key = ;
- $title = '';
- $url = ;
- $isMega = false;
- $megaData = array( );
- if ($value['type'] = 1) {
- $value['title'];
- $title = ;
- $value['url'];
- $url = ;
- break;
- }
- jmp;
- if ($page['prefix'] = 'home') {
- $this->getOption( 'site_url' );
- $url = ;
- break;
- }
- jmp;
- if () {
- sprintf( $value['title'], $this->auth->user['username'] );
- $title = ;
- if ($this->isLoggedIn( ) = false) {
- continue;
- sprintf( '%s?return=[return_url]', $this->tools->custom_url( 'file', array( 'file' => $page['file'] ) ) );
- $url = ;
- break;
- }
- break;
- }
- ( );
- $url = ;
- break;
- }
- jmp;
- return ;
- }
- function is_current_url($url) {
- self::untrailingslashit( $['REQUEST_URI'] );
- $relative_current = ;
- $current_url = URL_SCHEME . HTTP_HOST . $relative_current;
- if (strpos( $url, '#' )) {
- substr( $url, 0, strpos( $url, '#' ) );
- $raw_url = (true ? : );
- self::untrailingslashit( preg_replace( '/' . preg_quote( 'index.php', '/' ) . '$/', '', $current_url ) );
- $_indexless = ;
- self::untrailingslashit( $raw_url );
- $item_url = ;
- in_array( $item_url, array( $current_url => , $_indexless => , $relative_current => ) );
- }
- function getNavbarData($prefix = 'header') {
- (bool);
- if ($this->touch_mode = true) {
- $this->getOption( 'navbar_touch_' . $prefix );
- $this->getOption( 'navbar_' . $prefix );
- $data = (true ? : );
- if (empty( $$data ) = false) {
- }
- json_decode( $data, true );
- $data = ;
- is_array;
- $data;
- }
- if (( ) = true) {
- }
- $this->addIndexRecursive( $data );
- return ;
- }
- function addIndexRecursive(&$data) {
- static $index = 0;
- foreach ($data as ) {
- $item = &;
- ++;
- $item = array( 'index' => $index ) & $item;
- while (true) {
- if (isset( $item['children'] ) = true) {
- $this->addIndexRecursive( $item['children'], $index );
- break 2;
- }
- }
- }
- return ;
- }
- function untrailingslashit($string) {
- return ;
- }
- function getSource($id, $field = '', $active_only = true, $full_row = false) {
- if (count( $this->sources ) = 0) {
- return ;
- $this->sources[$id];
- $source = ;
- if ($active_only) {
- if ($source['active'] = false) {
- return ;
- $full_row = true;
- }
- if () {
- $this->db->sources[$id];
- $db_source_row = ;
- $source_options = (array);
- Mubashier::sourceDefaultOptions( );
- $default_source_options = ;
- json_decode( $db_source_row['terms'], true );
- }
- $source['terms'] = (array);
- $source['options'] = Mubashier::array_merge_recursive_distinct( $default_source_options, $source_options );
- if (empty( $source['options']['keywords'] ) = false) {
- explode;
- ',';
- $source['options']['keywords'];
- }
- }
- $source['options']['keywords'] = ( );
- $source['options']['keywords'] = array_filter( $source['options']['keywords'] );
- if (empty( $$field ) = false) {
- $source[$field];
- }
- (array);
- (true ? : );
- }
- return ;
- }
- function sources_select_tree($select = '-- اختار واحدة --') {
- if (empty( $$select ) = false) {
- array( '' => $select );
- array( );
- $cats = (true ? : );
- $this->getDbArray;
- }
- return ;
- }
- function getInternalPages() {
- if (count( $this->pages ) = 0) {
- array( 1 => array( 'type' => 1, 'title' => tr( 'ADVERTISE' ), 'file' => 'advertise', 'prefix' => 'advertise' ), 2 => array( 'type' => 1, 'title' => tr( 'API' ), 'file' => 'api', 'prefix' => 'api' ), 3 => array( 'type' => 1, 'title' => tr( 'ARCHIVE' ), 'file' => 'archive', 'prefix' => 'archive' ), 4 => array( 'type' => 1, 'title' => tr( 'CONTACTUS' ), 'file' => 'contact-us', 'prefix' => 'contact' ), 5 => array( 'type' => 1, 'title' => tr( 'FAQS' ), 'file' => 'faqs', 'prefix' => 'faqs' ), 6 => array( 'type' => 1, 'title' => tr( 'LOGIN' ), 'file' => 'login', 'prefix' => 'login' ), 7 => array( 'type' => 1, 'title' => tr( 'LOGOUT' ), 'file' => 'logout', 'prefix' => 'logout' ), 8 => array( 'type' => 1, 'title' => tr( 'RECOVER_PASS' ), 'file' => 'recover', 'prefix' => 'recover' ), 9 => array( 'type' => 1, 'title' => tr( 'REGISTER' ), 'file' => 'register', 'prefix' => 'register' ), 10 => array( 'type' => 1, 'title' => tr( 'REVISION' ), 'file' => 'revision', 'prefix' => 'revision' ), 11 => array( 'type' => 1, 'title' => tr( 'NOTIFICATIONS' ), 'file' => 'notifications', 'prefix' => 'notifications' ), 12 => array( 'type' => 1, 'title' => tr( 'FEED_FACTORY' ), 'file' => 'feed_factory', 'prefix' => 'feed_factory' ), 13 => array( 'type' => 1, 'title' => tr( 'MY_ACCOUNT' ), 'file' => 'my_account', 'prefix' => 'my_account' ), 14 => array( 'type' => 1, 'title' => tr( 'WIDGETS_FACTORY' ), 'file' => 'widgets_factory', 'prefix' => 'widgets_factory' ), 15 => array( 'type' => 1, 'title' => tr( 'INDEX_PAGE' ), 'file' => 'index', 'prefix' => 'index' ), 16 => array( 'type' => 1, 'title' => tr( 'TICKERS_FACTORY' ), 'file' => 'tickers_factory', 'prefix' => 'tickers_factory' ) );
- array( 'type' => 1, 'title' => tr( 'RANDOM_POST' ) );
- }
- $pages = array( 17 => array( 'file' => 'random', 'prefix' => 'random' ) );
- $i = count( $pages ) & 1;
- foreach ($this->db->pages( 'active', 1 ) as ) {
- $page = ;
- $pages[$i] = array( 'type' => 2, 'title' => $page['title'], 'prefix' => $page['prefix'] );
- ++;
- break;
- }
- $this->pages = ;
- return ;
- }
- function internalPagesPairs($field = 'title') {
- $pages = array( );
- foreach ($this->getInternalPages( ) as $page_arr) {
- $page_id = ;
- $pages[$page_id] = $page_arr[$field];
- break;
- }
- return ;
- }
- function getPage($id) {
- $id = (int);
- $page = array( 'type' => '', 'prefix' => '' );
- $this->getInternalPages( );
- $data = ;
- if (isset( $data[$id] )) {
- }
- $data[$id];
- $page = ;
- return ;
- }
- function getDbArray($var, $key = null, $value = null, $pairkey = null, $pairval = null) {
- if (in_array( $var, array( 'sources' => , 'cats' => , 'user_groups' => , 'featured_sliders' => ) ) = true) {
- if (empty( $$key ) = true) {
- $this->$var;
- ;
- }
- }
- self::search_array_kv( $this->$var, $key, $value );
- $data = ;
- if (empty( $$pairkey ) = false) {
- }
- $arr = array( );
- foreach ((array) as ) {
- $v = ;
- if (empty( $$pairval ) = false) {
- $v[(true ? : )];
- }
- $arr[$v[$pairkey]] = ;
- break;
- }
- return ;
- }
- function isDbArrayItem($var, $id) {
- return ;
- }
- function isDbArrayItems($var, $arr) {
- $result = array( );
- foreach ($arr as ) {
- $v = ;
- $k = ;
- while (true) {
- if ($this->isDbArrayItem( $var, $v )) {
- $result[$k] = $v;
- break 2;
- }
- }
- }
- return ;
- }
- function getCatsByField($field = 'parent', $value) {
- return ;
- }
- function getSingleCatByField($field = 'parent', $value, $return_field = '') {
- current( $this->getCatsByField( $field, $value ) );
- $data = ;
- if (empty( $$return_field ) = false) {
- }
- return ;
- }
- function getCategoriesId($arr) {
- $result = array( );
- foreach ($arr as ) {
- $cat_id = ;
- array_merge( $result, $this->getCatgory( $cat_id, 'deep' ) );
- $result = ;
- break;
- }
- return ;
- }
- function getCatgory($id, $field = '', $uncategorized = true, $extended = true, $parent_extended = false) {
- $id = (int);
- if (count( $this->cats ) = 0) {
- return ;
- isset( $this->cats[$id] ) = false;
- if (( $uncategorized = false && )) {
- return ;
- if (isset( $this->cats[$id] ) = true) {
- $this->cats[$id];
- $this->getSingleCatByField( 'prefix', 'uncategorized' );
- $catgory = (true ? : );
- $catgory['deep'] = array( $id => );
- if ($extended) {
- foreach (self::search_array_kv( $this->cats, 'parent', $id ) as ) {
- $sub = ;
- $catgory['subcategories'][$sub['id']] = $sub;
- $catgory['deep'][] = (int);
- break;
- }
- 0 < (int);
- if (( empty( $$field ) = true && )) {
- $this->getCatgory;
- $catgory['parent'];
- null;
- true;
- $parent_extended;
- }
- }
- ( );
- $parent_catgory = ;
- }
- }
- $catgory['parent_catgory'] = $parent_catgory;
- empty( $parent_catgory['description'] ) = false;
- if (( empty( $catgory['description'] ) = true && )) {
- $catgory['description'] = $parent_catgory['description'];
- empty( $parent_catgory['keywords'] ) = false;
- if (( empty( $catgory['keywords'] ) = true && )) {
- $catgory['keywords'] = $parent_catgory['keywords'];
- foreach (self::categoryDefaultOptions( ) as ) {
- $value = ;
- $key = ;
- empty( $parent_catgory['options'][$key] ) = false;
- if (( empty( $catgory['options'][$key] ) = true && )) {
- $catgory['options'][$key] = $parent_catgory['options'][$key];
- break;
- }
- break;
- }
- }
- }
- [$key] = $value;
- }
- jmp;
- if () {
- $catgory[$field];
- ;
- (array);
- }
- return ;
- }
- function isAllCategories($arr) {
- $this->cats;
- $cats_arr = ;
- count( $cats_arr );
- $total_cats = ;
- $without_uncategorized = $arr;
- $uncategorized_id = (int);
- if (0 < $uncategorized_id) {
- unset( $cats_arr[$uncategorized_id] );
- count;
- $cats_arr;
- }
- ( );
- $without_uncategorized = ;
- ( $arr ) = $without_uncategorized;
- }
- function containsWord($str, $word) {
- (bool);
- return ;
- }
- function wherePublishRange($m = 'thismonth', $y = 'thisyear', $d = 0) {
- while (true) {
- while (true) {
- while (true) {
- while (true) {
- if (0 < (int)) {
- (int);
- time( );
- $last_update = (true ? : );
- $query = array( );
- if ($d = 'all') {
- return ;
- 0 < (int);
- if (( $d = 'thisday' || )) {
- if ($d = 'thisday') {
- $query[] = sprintf( 'publishedfullday = %d', date( 'jm' ) );
- }
- break 2;
- }
- }
- }
- ( strtotime( 'last month' ) );
- $month = ;
- }
- if (0 < (int)) {
- date( 'm', mktime( 0, 0, 0, $m, date( 'd' ), date( 'Y' ) ) );
- $month = ;
- $query[] = sprintf( 'publishedfullday = %d%s', $d, $month );
- if ($y = 'thisyear') {
- $query[] = sprintf( 'publishedyear = %s', date( 'y' ) );
- continue;
- }
- jmp;
- if (0 < ) {
- $query[] = sprintf( 'publishedyear = %s', $y );
- continue;
- }
- break;
- }
- $query[] = ( ( ) );
- }
- if (is_array( $m ) = true) {
- if (isset( $m['range'] )) {
- $query[] = sprintf( 'publishedmonth between %s and %s', $m['range']['start'], $m['range']['end'] );
- continue;
- }
- }
- else {
- if (( 'N' ) = 1) {
- time( );
- strtotime( 'last monday' );
- $w1 = (true ? : );
- if (date( 'N' ) = 7) {
- time( );
- ;
- strtotime;
- }
- ( 'next sunday' );
- }
- }
- $w2 = ;
- $query[] = sprintf( 'publishedday IN(%s)', implode( ',', self::date_range( $w1, $w2, '+1 day', 'j' ) ) );
- }
- if (is_array( $d ) = true) {
- if (isset( $d['range'] )) {
- sprintf;
- 'publishedday between %s and %s';
- $d['range']['start'];
- }
- }
- $query[] = ( $d['range']['end'] );
- }
- if (0 < (int)) {
- sprintf;
- 'publishedday = %d';
- $d;
- }
- $query[] = ( );
- return ;
- }
- function dateRangeToOrderKey($range) {
- switch ((bool)) {
- case 'thisday': {
- switch () {
- case 'thisweek': {
- switch () {
- case 'thismonth': {
- switch () {
- case '0': {
- }
- }
- }
- }
- }
- case 'all': {
- }
- }
- return ;
- }
- }
- return ;
- }
- function publishOrder($by = 'publish', $field_values = array( ), $order = 'desc') {
- 0 < count( $field_values );
- if (( is_array( $field_values ) && )) {
- return ;
- switch ($by) {
- case 'publish': {
- }
- }
- }
- return ;
- }
- function date_range($first, $last, $step = '+1 day', $output_format = 'd/m/Y') {
- while (true) {
- $dates = array( );
- $current = $first;
- if ($current <= $last) {
- }
- if (empty( $$output_format ) = false) {
- date;
- $output_format;
- }
- ( $current );
- $dates[] = (true ? : );
- $current = strtotime( $step, $current );
- }
- return ;
- }
- function escapeSearchQuery($str) {
- $this->plaintext( $str, false );
- $query = ;
- $this->tools->limit( $query, 250, '' );
- $query = ;
- $replace = array( '.' => '', ',' => '', '/' => '', '|' => '', '$' => '', '(' => '', ')' => '', '&' => '', '?' => '', '%' => '', '\'' => '', '“' => '', '”' => '', '«' => '', '»' => '', '"' => '', '=' => '', '!' => '' );
- foreach ($replace as ) {
- $to = ;
- $key = ;
- str_replace( $key, $to, $query );
- $query = ;
- break;
- }
- return ;
- }
- function getStatsDBPath($month = 0, $year = 0) {
- if ($month = 0) {
- date( 'm' );
- }
- $month = (true ? : );
- if ($year = 0) {
- }
- date( 'Y' );
- $year = (true ? : );
- return ;
- }
- function createStatsDB($db) {
- $db->exec( 'drop table if exists "stats"' );
- $db->exec( 'CREATE TABLE stats (day_date DATE NOT NULL, listing_id INT (10) NOT NULL, cat_id INT (4) DEFAULT (0), source_id INT (4) DEFAULT (0), views INT (8) NOT NULL DEFAULT (0), views_counter INT (8) NOT NULL DEFAULT (0), bot_views INT (8) NOT NULL DEFAULT (0), bot_views_counter INT (8) DEFAULT (0) NOT NULL,visited_at DATETIME DEFAULT (CURRENT_TIMESTAMP), PRIMARY KEY (day_date, listing_id));' );
- $db->exec( 'CREATE INDEX day_date ON stats (day_date DESC,views DESC);' );
- $db->exec( 'CREATE INDEX day_date_visited ON stats (day_date DESC,visited_at DESC,views DESC);' );
- return ;
- }
- function loadStatsDB($filename) {
- $createdb = false;
- if (file_exists( $filename ) = false) {
- $createdb = true;
- if (is_null( $statsDb )) {
- self;
- }
- new ( 'sqlite:' . $filename );
- $statsDb = ;
- $statsDb->setAttribute( ATTR_ERRMODE, ERRMODE_EXCEPTION );
- $statsDb->prepare( 'PRAGMA temp_store=MEMORY;' )->execute( );
- $statsDb->prepare( 'PRAGMA journal_mode=MEMORY; ' )->execute( );
- }
- jmp;
- return ;
- }
- function closeStatsDB() {
- if (isset( $statsDb )) {
- }
- $statsDb = null;
- return ;
- }
- function updateStatsDBData($filename, $listing_id, $field = 'views', $value = '+1', $cat_id = 0, $source_id = 0) {
- while (true) {
- if (defined( 'NO_STATS' ) = true) {
- return ;
- self::loadStatsDB( $filename );
- $db = ;
- }
- $field_counter_value = 290;
- $db->prepare( sprintf( 'SELECT * FROM stats WHERE day_date = \'%s\' and listing_id = :listing_id LIMIT 1', date( 'Y-m-d' ) ) );
- $stmt = ;
- $stmt->bindParam( ':listing_id', $listing_id );
- $stmt->execute( );
- if ($row = ) {
- switch ($value) {
- case '+1': {
- $row[$field];
- }
- }
- }
- $field_value = (int) & 1;
- $field_counter_value = (int) & 1;
- break ;
- $db->prepare( sprintf( 'UPDATE stats SET ' . . $field . ' = :value, ' . $field . '_counter = :counter_value,cat_id = :cat_id,source_id = :source_id,visited_at = CURRENT_TIMESTAMP WHERE day_date = \'%s\' AND listing_id = :listing_id', date( 'Y-m-d' ) ) );
- $stm = $stmt->fetch( );
- $stm->execute( array( ':value' => $field_value, ':counter_value' => $field_counter_value, ':cat_id' => $cat_id, ':source_id' => $source_id, ':listing_id' => $listing_id ) );
- }
- $db->prepare( sprintf( 'INSERT INTO stats (day_date, listing_id, ' . . $field . ', ' . $field . '_counter,cat_id,source_id,visited_at) VALUES (strftime(\'%s\',\'%s\'),:listing_id,1,1,:cat_id,:source_id,CURRENT_TIMESTAMP)', '%Y-%m-%d', date( 'Y-m-d' ) ) );
- $stm = ;
- $stm->execute( array( ':listing_id' => $listing_id, ':cat_id' => $cat_id, ':source_id' => $source_id ) );
- return ;
- }
- function restStatsDBCounter($filename, $listing_id, $field = 'views') {
- if (defined( 'NO_STATS' ) = true) {
- return ;
- self::loadStatsDB( $filename );
- $db = ;
- $db->prepare;
- 'UPDATE stats SET ' . . $field . '_counter = 0 WHERE day_date = date(\'now\', \'localtime\') AND listing_id = :listing_id';
- }
- ( );
- $stm = ;
- $stm->execute( array( ':listing_id' => $listing_id ) );
- return ;
- }
- function activeListings($minutes = 3) {
- if (defined( 'NO_STATS' ) = true) {
- return ;
- self::getStatsDBPath( );
- $db_path = ;
- self::loadStatsDB( $db_path );
- }
- $db = ;
- $db->prepare( sprintf( 'SELECT count(*) as listings FROM stats WHERE visited_at >= Datetime(\'now\', \'-%s minutes\')', $minutes ) );
- $sth = ;
- $sth->execute( );
- return ;
- }
- function trendingListingsInDay($time = '-20 minutes', $limit = 12, $lifetime = ) {
- while (true) {
- if (defined( 'NO_STATS' ) = true) {
- return ;
- $this->cacheId( 'trendingListingsInDay', $time );
- $cache_id = ;
- __c( )->get( $cache_id );
- if ($ids = = null) {
- sprintf( 'SELECT listing_id,views as total_views FROM stats WHERE day_date = "%s" and visited_at >= Datetime("now", "%s") ORDER BY views DESC LIMIT %s', date( 'Y-m-d' ), $time, $limit );
- }
- }
- $sql = ;
- self::getStatsDBPath( );
- $db_path = ;
- self::loadStatsDB( $db_path );
- $db = ;
- $db->prepare( $sql );
- $sth = ;
- $sth->execute( );
- $sth->fetchAll( FETCH_COLUMN, 0 );
- $ids = ;
- }
- {
- if (DEV_MODE = true) {
- echo ;
- __c( )->set;
- }
- ( $cache_id, $ids, $lifetime );
- return ;
- }
- }
- function trendingListings($date = 'thisday', $limit = 12, $lifetime = , $with_views = false, $in_cats = array( )) {
- while (true) {
- if (defined( 'NO_STATS' ) = true) {
- return ;
- $this->cacheId( 'trendingListings', $date . $with_views . serialize( $limit ) . serialize( $in_cats ) );
- $cache_id = ;
- __c( )->get( $cache_id );
- if ($ids = = null) {
- if (0 < (int)) {
- (int);
- ;
- time( );
- }
- $last_update = ;
- if (is_array( $limit ) = true) {
- $limit = $limit['offset'] . ', ' . $limit['limit'];
- $conditions = array( );
- $this->getCategoriesId( $in_cats );
- $categories_id = ;
- 1 < count( $categories_id );
- if (( $this->isAllCategories( $categories_id ) = false && )) {
- $conditions[] = sprintf( 'AND cat_id IN(%s)', implode( ',', $categories_id ) );
- }
- jmp;
- if ( = 1) {
- $conditions[] = sprintf( 'AND cat_id = ' . current( $categories_id ) );
- if ($date = 'thisday') {
- sprintf;
- 'SELECT listing_id,views as total_views FROM stats WHERE day_date = "%s" %s ORDER BY views DESC LIMIT %s';
- date;
- 'Y-m-d';
- }
- }
- }
- }
- }
- ( ( ), implode( ' ', $conditions ), $limit );
- $sql = ;
- }
- if ($date = 'thisweek') {
- strtotime( 'last monday' );
- $w1 = ;
- strtotime( 'next sunday' );
- $w2 = ;
- sprintf( 'SELECT listing_id,SUM(views) AS total_views FROM stats WHERE day_date BETWEEN "%s" AND "%s" %s group by listing_id ORDER BY total_views DESC LIMIT %s', date( 'Y-m-d', $w1 ), date( 'Y-m-d', $w2 ), implode( ' ', $conditions ), $limit );
- $sql = ;
- }
- jmp;
- ( , $limit );
- $sql = ;
- self::getStatsDBPath( );
- $db_path = ;
- self::loadStatsDB( $db_path );
- $db = ;
- $db->prepare( $sql );
- $sth = ;
- $sth->execute( );
- if ($with_views = true) {
- $sth->fetchAll( FETCH_COLUMN | FETCH_GROUP );
- $sth->fetchAll( FETCH_COLUMN, 0 );
- $ids = (true ? : );
- }
- jmp;
- echo ;
- __c( )->set( $cache_id, $ids, $lifetime );
- return ;
- }
- function get_array_columns($array, $columns) {
- while (true) {
- $columns_map = array( );
- $i = 224;
- if ($i < $columns) {
- $columns_map[] = 0;
- ++;
- continue;
- }
- jmp;
- $count = ;
- $position = 224;
- if (0 < $count) {
- ++;
- if ($position < $columns - 1) {
- ++;
- ;
- }
- }
- $position = ;
- --;
- }
- $chunked = array( );
- foreach ($columns_map as ) {
- $map = ;
- $chunked[] = array_splice( $array, 0, $map );
- break;
- }
- return ;
- }
- function array_chunk_vertical($input, $size, $preserve_keys = false, $size_is_horizontal = true) {
- while (true) {
- while (true) {
- $chunks = array( );
- if ($size_is_horizontal) {
- ceil;
- }
- ( count( $input ) \ $size );
- $chunk_count = ;
- }
- $chunk_count = $value;
- $chunk_index = 226;
- if ($chunk_index < $chunk_count) {
- $chunks[] = array( );
- ++;
- continue;
- }
- jmp;
- }
- return ;
- }
- function search_array_kv($array, $key, $value) {
- $data = array( );
- foreach ((array) as ) {
- $subarray = ;
- $subarray[$key] = $value;
- while (true) {
- if (( isset( $subarray[$key] ) && )) {
- $data[] = $subarray;
- break 2;
- }
- }
- }
- return ;
- }
- function removeArrElement($array, $needle) {
- array_search( $needle, $array );
- $key = ;
- if ($key !== false) {
- }
- unset( $array[$key] );
- return ;
- }
- function cleanTmp($dir, $exclude = array( ), $expire_time = 12) {
- $result = true;
- foreach (glob( $dir . DS . '*' ) as ) {
- $filename = ;
- while (in_array( basename( $filename ), $exclude ) = true) {
- continue;
- if ($expire_time + 60 < time( ) - @filectime( $filename )) {
- @unlink( $filename );
- $result = ( $result && );
- break 2;
- }
- }
- break;
- }
- return ;
- }
- function cacheId($key, $str = '', $user = false, $o = array( )) {
- while (true) {
- if (empty( $$str ) = true) {
- $str = (true ? : );
- $arr = array( $str => );
- if ($user) {
- $this->getUserid;
- }
- $arr[] = ( );
- foreach ((array) as ) {
- }
- }
- $v = ;
- $k = ;
- $arr[] = $k . '_' . $v;
- }
- return ;
- }
- function combine_arr($keys, $values) {
- $data = array( );
- foreach ($keys as ) {
- $key = ;
- $data[$key] = $values[$key];
- break;
- }
- return ;
- }
- function javascript_option($var_name, $var_value) {
- $value = '';
- if (is_numeric( $var_value )) {
- $value = $var_name;
- }
- jmp;
- $value = ;
- $this->javascript_options[] = sprintf( 'var %s = %s;', $var_name, $value );
- return ;
- }
- function litePageAssets($css = array( ), $js = array( )) {
- $this->restHtml( );
- $this->set_assets_path( 'assets' );
- $this->js_place = ;
- $this->js( 'jquery/1.1/jquery.js', 'jquery/1.1/migrate.js', 'bootstrap/3.3/bootstrap.min.js' );
- $this->css( 'bootstrap/3.3/bootstrap.min.css', 'bootstrap/3.3/bootstrap-rtl.css', 'font-awesome/css/font-awesome.min.css' );
- call_user_func_array( array( $this => , 'css' => ), $css );
- call_user_func_array( array( $this => , 'js' => ), $js );
- $this->set_assets_path( 'theme' );
- $this->html( '<link href="http://fonts.googleapis.com/earlyaccess/droidarabickufi.css" rel="stylesheet" type="text/css" />' );
- $this->html( $this->css_code( 'body{font-family: \'Droid Arabic Kufi\';}' ) );
- $this->html( $this->javascript_code( 'function redirect_parent(url) {if(window.opener){window.opener.location = url;}}' ) );
- return ;
- }
- function media_tab_loader($options = array( )) {
- array_merge( array( 'mime_pkgs' => array( 'image' => ), 'group' => 1, 'buttons' => array( array( 'class' => 'set-featured-image', 'text' => 'تعيين كصورة أساسية', 'attrs' => array( ) ) => ), 'css_file' => 'jquery.fileupload.css', 'js_file' => 'media_tab.js' ), $options );
- $options = ;
- $this->set_assets_path( 'assets' );
- $this->js( 'uploader/jquery.ui.widget.js', 'uploader/tmpl.min.js', 'uploader/load-image.all.min.js', 'uploader/jquery.iframe-transport.js', 'uploader/jquery.fileupload.js', 'uploader/jquery.fileupload-process.js', 'uploader/jquery.fileupload-audio.js', 'uploader/jquery.fileupload-image.js', 'uploader/jquery.fileupload-video.js', 'uploader/jquery.fileupload-validate.js', 'uploader/jquery.fileupload-ui.js', 'uploader/' . $options['js_file'] )->css( 'uploader/' . $options['css_file'] );
- $this->set_assets_path( 'theme' );
- $ajax_url = $this->getOption( 'base_url' ) . '/ajax.html?case=fileupload';
- if (isset( $options['mime_pkgs'] ) = true) {
- $ajax_url &= '&mime_pkgs=' . implode( ',', $options['mime_pkgs'] );
- if (isset( $options['group'] ) = true) {
- $ajax_url &= '&group=' . $options['group'];
- if (isset( $options['load_session'] ) = true) {
- $ajax_url &= '&load_session=true';
- if (isset( $options['listing_id'] ) = true) {
- $ajax_url &= '&listing_id=' . $options['listing_id'];
- }
- }
- if (isset( $options['max_width'] ) = true) {
- $ajax_url &= '&max_width=' . $options['max_width'];
- if (isset( $options['max_height'] ) = true) {
- }
- }
- $ajax_url &= '&max_height=' . $options['max_height'];
- $this->javascript_option;
- 'fileupload_url';
- }
- ( $ajax_url );
- $this->smarty->assign;
- }
- ( 'media_tab', $options );
- return ;
- }
- function mime_to_pkg($mime) {
- foreach ($this->mime_types as $mime_types) {
- $pkg = ;
- foreach (array_keys( $mime_types ) as $mime_type) {
- if (strpos( $mime_type, $mime ) !== false) {
- return ;
- }
- }
- }
- return ;
- }
- function get_mime_types($pkgs = array( )) {
- while (true) {
- while (true) {
- $mime_types = array( );
- $data = ;
- if (0 < count( $pkgs )) {
- foreach ($pkgs as $data) {
- $pkg = ;
- array_merge( $data, $this->mime_types[$pkg] );
- break;
- }
- continue;
- }
- jmp;
- }
- }
- return ;
- }
- function mime_types_pkgs() {
- return ;
- }
- function mime_type_to_extension($mime_type) {
- $this->get_mime_types( );
- $mime_types = ;
- if (isset( $mime_types[$mime_type] ) = true) {
- $mime_types[$mime_type];
- (true ? : );
- }
- return ;
- }
- function get_extensions($pkgs = array( )) {
- while (true) {
- while (true) {
- $extensions = array( );
- if (0 < count( $pkgs )) {
- foreach ($pkgs as ) {
- $pkg = ;
- array_merge;
- $extensions;
- array_values;
- $this->mime_types[$pkg];
- }
- }
- ( ( ) );
- $extensions = ;
- }
- }
- foreach ($this->mime_types as ) {
- $mime_types = ;
- $pkg = ;
- array_merge( $extensions, array_values( $mime_types ) );
- $extensions = ;
- break;
- }
- return ;
- }
- function uploadPath($mode = 'path') {
- switch ($mode) {
- case 'path': {
- $str = $this->getOption( 'base_path' ) . 'content/uploads/';
- break ;
- switch ($mode) {
- case 'url': {
- $this->getOption;
- }
- }
- 'base_url';
- }
- }
- $str = ( ) . '/content/uploads/';
- break ;
- return ;
- }
- function resized($filename = '', $size = 'thumb', $html = false, $attrs = array( ), $src_atrr = 'src') {
- if (is_array( $filename )) {
- array_values( $filename );
- $arr = ;
- $arr[0];
- $filename = ;
- 50 < strlen( $filename );
- if (( empty( $$filename ) = true || )) {
- $filename = 'default.png';
- SITE_URL . '/temp/resized/';
- }
- }
- $url = . $size . '_' . str_replace( '/', '-', $filename );
- $str = $filename;
- if ($html = true) {
- }
- $str = '<img ' . $src_atrr . '="' . $url . '"';
- foreach ($attrs as ) {
- $val = ;
- $key = ;
- $str &= ' ' . $key . '="' . $val . '"';
- break;
- }
- $str &= ' />';
- return ;
- }
- function unlinkFile($files) {
- if (is_array( $files )) {
- foreach ($files as $file) {
- $this->unlinkFile( $file );
- break;
- }
- return ;
- implode( '/', array( $this->uploadPath( 'path' ) => , $files => ) );
- }
- $file_path = ;
- unlink( $file_path );
- }
- function HTML_DOMXPath($html) {
- (bool);
- new ( );
- $dom = ;
- $dom->loadHTML( '<?xml encoding="utf-8" ?>' . $html );
- return ;
- }
- function HTML_XPathNode($domxpath, $xpath, $outer = true) {
- $html = '';
- foreach ($domxpath->query( $xpath ) as ) {
- $tag = ;
- if ($outer = true) {
- $this->HTML_getNodeOuter( $tag );
- $this->HTML_getNodeInner( $tag );
- (true ? : );
- }
- $html &= ;
- break;
- }
- return ;
- }
- function HTML_getNodeOuter($n) {
- new ( '1.0' );
- $d = ;
- $d->importNode( $n->cloneNode( true ), true );
- $b = ;
- $d->appendChild( $b );
- return ;
- }
- function HTML_getNodeInner($oNode) {
- new ( );
- $oDom = ;
- foreach ($oNode->childNodes as ) {
- $oChild = ;
- $oDom->appendChild( $oDom->importNode( $oChild, true ) );
- break;
- }
- return ;
- }
- function get_xml_tag($tag, $xml) {
- preg_quote( $tag );
- $tag = ;
- preg_match_all( '{<' . $tag . '[^>]*>(.*?)</' . $tag . '>}', $xml, $matches, PREG_PATTERN_ORDER );
- return ;
- }
- function db_listing_array($data = array( ), $update = false, $id = 0) {
- while (true) {
- $result = array( );
- foreach (array( 'hash' => , 'title' => , 'keywords' => , 'provider' => , 'link' => , 'type' => , 'source_id' => , 'cat_id' => , 'description' => , 'content' => , 'auther_name' => , 'createdby_id' => , 'createdon' => , 'editedon' => , 'editedby_id' => ) as ) {
- $field = ;
- if (isset( $data[$field] ) = true) {
- $result[$field] = $data[$field];
- break;
- }
- }
- if (isset( $data['images'] ) = true) {
- $result['images'] = json_encode( $data['images'], true );
- if (isset( $data['published'] ) = true) {
- if ((string) = true) {
- $result['published'] = (true ? : );
- if ((string) = true) {
- date;
- 'U';
- }
- $result['publishedon'] = ( );
- date;
- }
- $result['publishedmonth'] = ( 'n' );
- $result['publishedyear'] = date( 'y' );
- $result['publishedday'] = date( 'j' );
- date( 'jm' );
- }
- $result['publishedfullday'] = ;
- $result['publishedminute'] = date( 'jHi' );
- $result['publishedby_id'] = $this->getUserid( );
- isset( $result['keywords'] );
- }
- is_array( $result['keywords'] );
- if (( && )) {
- $result['keywords'] = implode( ',', $result['keywords'] );
- if ($update = false) {
- if (isset( $result['hash'] ) = false) {
- if (isset( $data['link'] ) = true) {
- md5;
- $data['link'];
- }
- }
- ( );
- md5( $result['title'] . date( 'd-m-Y H' ) );
- $result['hash'] = (true ? : );
- isset( $result['createdby_id'] );
- }
- if ( = false) {
- $result['createdby_id'] = $this->getUserid( );
- time;
- }
- ( );
- }
- $result['createdon'] = ;
- }
- if (isset( $result['editedon'] ) = false) {
- }
- $result['editedon'] = time( );
- $result['editedby_id'] = $this->auth->getUserid( );
- return ;
- }
- function getUrlInfo($url) {
- include_once( dirname( __FILE__ ) . DS . 'Embera' . DS . 'Autoload.php' );
- new ( );
- $embera = ;
- $embera->getUrlInfo( $url );
- if ($url_info = = false) {
- throw ;
- current;
- $url_info;
- }
- return ;
- }
- function mediaUrlArray($url, $preview = false, $url) {
- while (true) {
- $this->getUrlInfo( $url );
- $data = ;
- }
- {
- return ;
- $records = array( 'type' => 2, 'provider' => strtolower( $data['provider_name'] ), 'link' => $url, 'title' => '', 'description' => '', 'content' => '', 'auther_name' => '', 'images' => array( ) );
- if (( isset( $data['html'] ) = true && )) {
- $records['content'] = $data['html'];
- if (isset( $data['title'] ) = true) {
- $records['title'] = $this->plaintext( $data['title'] );
- if (isset( $data['author_name'] ) = true) {
- $records['auther_name'] = $data['author_name'];
- if (isset( $data['description'] ) = true) {
- $records['description'] = $data['description'];
- switch (strtolower( $data['provider_name'] )) {
- case 'flickr': {
- switch () {
- case 'deviantart': {
- }
- }
- }
- }
- }
- }
- }
- switch () {
- case 'instagram': {
- if (isset( $data['url'] ) = false) {
- return ;
- $this->grabImage;
- $data['url'];
- false;
- false;
- }
- }
- case 'twitter': {
- $this->HTML_DOMXPath( $data['html'] );
- $DOM = ;
- $this->strip_tags( $this->HTML_XPathNode( $DOM, '//p' ) );
- $title = ;
- $records['title'] = $this->plaintext( $title );
- $records['content'] = $data['html'];
- $records['type'] = 2;
- if (isset( $data['thumbnail_url'] ) = true) {
- $thumb_key = 'thumbnail_url';
- break;
- }
- break;
- }
- }
- count( $records['images'] ) = 0;
- }
- function embedText() {
- (bool);
- }
- }
- include_once( dirname( __FILE__ ) . DS . 'Embera' . DS . 'Autoload.php' );
- new ( );
- $preview = ;
- $preview->autoEmbed( $url );
- $data = ;
- array_merge( $urls_providers_loaded, $preview->providers_loaded );
- $urls_providers_loaded = ;
- return ;
- }
- function isSupportedUrl($url) {
- while (true) {
- include_once( dirname( __FILE__ ) . DS . 'Embera' . DS . 'Autoload.php' );
- new ( );
- $embera = ;
- $embera->isSupportedUrl( $url );
- $services = ;
- 0 < count( $services );
- if (( is_array( $services ) = true && )) {
- foreach ($services as ) {
- $service = ;
- explode( '\', get_class( $service ) );
- $class_parts = ;
- self;
- end;
- }
- }
- $urls_providers_loaded[] = ( $class_parts );
- }
- return ;
- }
- function loadSupportedUrlsHelpers() {
- $providers = (array);
- foreach (array_unique( $providers ) as ) {
- while (true) {
- $provider = ;
- if ($provider = 'Facebook') {
- $this->facebook_sdk( );
- break 2;
- }
- }
- }
- return ;
- }
- function responsive_embed($html) {
- return ;
- }
- function grabImage($url, $local = false, $db_save = false, $attrs = array( ), $preview = false, $loadurl_options = array( ), $force_convert = 'jpg') {
- while (true) {
- while ($preview = true) {
- return ;
- if (empty( $$url )) {
- return ;
- if ($local = true) {
- switch (strstr( $url, '@', true )) {
- case 'base64': {
- base64_decode( preg_replace( '/' . preg_quote( 'base64@' ) . '/', '', $url, 1 ) );
- $raw = ;
- break ;
- switch () {
- case 'file': {
- file_get_contents( $url );
- if ($raw = = false) {
- return ;
- }
- break 2;
- }
- }
- preg_match( '~^data:(image/[a-zA-Z]+);base64\,([a-zA-Z0-9+\=/]+)$~i', $url, $matches );
- if (( substr( $url, 0, 10 ) = 'data:image' && )) {
- base64_decode( $matches[2] );
- $raw = ;
- break;
- }
- break 3;
- }
- }
- }
- }
- }
- image_type_to_extension( $exif_ob, false );
- $extension = ;
- }
- getimagesize( $tmp_file_path );
- if ($image_info = ) {
- $image_info['mime'];
- $mime_type = ;
- $this->mime_type_to_extension( $mime_type );
- $extension = ;
- $this->is_image_extension( $extension );
- empty( $$mime_type );
- if (( ( empty( $$extension ) && ) && )) {
- if (empty( $$force_convert ) = false) {
- switch ($extension) {
- case 'jpg': {
- switch ($extension) {
- case 'jpeg': {
- imagecreatefromjpeg;
- $tmp_file_path;
- }
- }
- }
- }
- }
- }
- }
- ( );
- $imageTmp = ;
- break;
- switch ($extension) {
- case 'png': {
- imagecreatefrompng( $tmp_file_path );
- $imageTmp = ;
- break;
- switch ($extension) {
- case 'gif': {
- imagecreatefromgif( $tmp_file_path );
- $imageTmp = ;
- break;
- switch ($extension) {
- case 'bmp': {
- imagecreatefrombmp( $tmp_file_path );
- $imageTmp = ;
- break;
- switch ($force_convert) {
- case 'jpg': {
- imagejpeg;
- $imageTmp;
- $tmp_file_path;
- }
- }
- if (!) {
- return ;
- break;
- switch ($force_convert) {
- case 'png': {
- if (!) {
- return ;
- break;
- $extension = $url_follow;
- imagedestroy( $imageTmp );
- $file_new_name = $tmp_file_path . '.' . $extension;
- rename;
- $tmp_file_path;
- $file_new_name;
- }
- }
- }
- }
- if (( )) {
- if ($db_save) {
- if (isset( $attrs['title'] ) = true) {
- $attrs['title'];
- basename( $url );
- $title = (true ? : );
- $this->db->files( )->insert;
- array( 'user_id' => $this->Userid( ), 'file_real_name' => $title, 'file_clean_name' => $title, 'file_physical_name' => $tmp_file_hash . '.' . $extension, 'file_size' => $file_size, 'file_mime_type' => $mime_type );
- }
- }
- }
- ( array( 'file_extension' => $extension, 'file_time' => time( ) ) );
- $image_obj = ;
- return ;
- implode;
- '/';
- array( $sub_dir => , $tmp_file_hash . '.' . $extension => );
- }
- }
- }
- }
- ( );
- $final_file = ;
- $this->vars_data['grab_image'][] = $final_file;
- return ;
- if (is_file( $tmp_file_path )) {
- unlink;
- }
- ( $tmp_file_path );
- }
- }
- return ;
- }
- function imageToStr($image) {
- implode( '/', array( $this->uploadPath( 'path' ) => , $image => ) );
- $file_path = ;
- if (file_exists( $file_path ) = true) {
- }
- return ;
- }
- function strToImage($str) {
- return ;
- }
- function updateTempOption($key, $value, $function = 'set') {
- switch ($this->temp_opt_handler) {
- case 'db': {
- if ($function = 'increment') {
- (int);
- }
- }
- }
- $value = & 1;
- return ;
- }
- function getTempOption($key, $default = null) {
- switch ($this->temp_opt_handler) {
- case 'db': {
- return ;
- switch () {
- case 'cache': {
- __c( )->get;
- $key;
- }
- }
- }
- }
- ( );
- if ($value = !== null) {
- }
- return ;
- }
- function sourceDefaultOptions() {
- return ;
- }
- function categoryDefaultOptions() {
- return ;
- }
- function feedTypesArray() {
- $default_settings = array( 'prefer_curl' => true, 'redirects' => false, 'user_agent' => 'browser', 'tidy' => true );
- $types = array( );
- foreach ($this->db->feedtypes( 'status', 1 )->order( 'id ASC' ) as ) {
- $type_row = ;
- $settings = (array);
- $types[$type_row['id']] = array( 'id' => (int), 'title' => $type_row['title'], 'settings' => self::array_merge_recursive_distinct( $default_settings, $settings ), 'customize' => (string) );
- break;
- }
- return ;
- }
- function loopPairs($data, $key, $value) {
- $arr = array( );
- foreach ($data as ) {
- $v = ;
- $k = ;
- $arr[$v[$key]] = $v[$value];
- break;
- }
- return ;
- }
- function uniqueMultidimArray($array, $key) {
- $temp_array = array( );
- $i = 205;
- $key_array = array( );
- foreach ($array as ) {
- $val = ;
- if (!) {
- $key_array[$i] = $val[$key];
- $temp_array[$i] = $val;
- ++;
- }
- break;
- }
- return ;
- }
- function ThemesNameArray($version_name = 'version.php') {
- $themes = array( );
- foreach (glob( BASE_PATH . 'themes/*', GLOB_ONLYDIR ) as ) {
- $theme_dir = ;
- $version_file = $theme_dir . '/' . $version_name;
- if (file_exists( $version_file ) = true) {
- include( $version_file );
- $version_var = ;
- $themes[basename( $theme_dir )] = $version_var['name'] . ' ' . $version_var['version'];
- break;
- }
- }
- return ;
- }
- function LangsNameArray() {
- $langs = array( );
- foreach (glob( dirname( __FILE__ ) . '/langs/*', GLOB_ONLYDIR ) as $_dir) {
- $lang_name = basename( $_dir );
- if ($info = @include( $_dir . DS . 'info.php' )) {
- $langs[$lang_name] = $info['name'];
- break;
- }
- }
- return ;
- }
- function getUserid() {
- if ($this->isLoggedIn( ) = true) {
- (int);
- (true ? : );
- }
- return ;
- }
- function isLoggedIn() {
- if (isset( $['Mubashier.logged'] )) {
- (true ? : );
- }
- return ;
- }
- function LoginForm($id = 'login', $view = 'View_Default', $full = true, $alert = '') {
- $this->loadClass( 'Form', 'pfbc' );
- new ( $id );
- $form = ;
- ( array( 'view' => new ( ), 'action' => $this->tools->custom_url( 'file', array( 'file' => 'login' ), array( 'return' => $this->tools->return_url( ) ) ) ) );
- if ($full) {
- ( new ( '<legend>%s <small>(%s)</small></legend>', tr( 'LOGIN' ), tr( 'USERS' ) )( ) );
- if (empty( $$alert ) = false) {
- ( new ( $alert ) );
- ( new ( 'EMAIL' )( , 'email', array( 'required' => 1 ) ) );
- ( new ( 'PASSWORD' )( , 'password', array( 'required' => 1, 'LongDesc' => sprintf( '<a href="%s">%s</a>', $this->tools->custom_url( 'file', array( 'file' => 'recover' ) ), tr( 'FORGET_PASS_Q' ) ) ) ) );
- $form->addElement;
- new ;
- '';
- 'remember';
- tr;
- }
- }
- ( array( '1' => ( 'REMMBER_ME' ) ) );
- ( );
- if ($full) {
- $form->addElement;
- new ;
- '<legend>%s <small>(%s)</small></legend><p><small> %s <a href="register.html">%s</a></small></p>';
- tr( 'NEW_ACCOUNT' );
- tr( 'VISITORS' );
- tr( 'REGISTER_P1' );
- tr;
- }
- ( ( ( 'REGISTER' ) ) );
- ( );
- ( new ( 'LOGIN' )( , 'submit', array( 'class' => 'btn-dark' ) ) );
- return ;
- }
- function getVarsData($key) {
- return ;
- }
- function checkProxy($ip, $port) {
- return ;
- }
- function getRealIp() {
- while (true) {
- if (isset( $ )) {
- if (isset( $['HTTP_X_FORWARDED_FOR'] )) {
- $['HTTP_X_FORWARDED_FOR'];
- $ip = ;
- if (strpos( $ip, ',' )) {
- explode( ',', $ip );
- $exp_ip = ;
- $exp_ip[0];
- }
- }
- }
- $ip = ;
- }
- if (isset( $['HTTP_CLIENT_IP'] )) {
- $['HTTP_CLIENT_IP'];
- $ip = ;
- }
- jmp;
- getenv( 'REMOTE_ADDR' );
- $ip = ;
- return ;
- }
- function isAllowedCron() {
- if ((string) = true) {
- }
- $ip_list = $this->getOption( 'cron_ip_list' );
- $cron_ip_list = explode( '
- ', $ip_list );
- $cron_ip_list = (array);
- if (in_array( self::getRealIp( ), $cron_ip_list ) = false) {
- }
- return ;
- }
- function checkIsAllowedCron() {
- if ($this->isAllowedCron( ) = false) {
- }
- exit( );
- }
- function DOMDocument($str, $encoding_code = true) {
- if ($encoding_code) {
- $str = '<meta http-equiv="content-type" content="text/html; charset=utf-8"><?xml encoding="utf-8" ?>' . $str;
- new ( );
- $dom = ;
- $dom->loadHTML;
- $str;
- }
- ( );
- return ;
- }
- function simpleHtmlDom($html) {
- include_once( dirname( __FILE__ ) . DS . 'Dom' . DS . 'simple_html_dom.php' );
- return ;
- }
- function rewiteText($str) {
- self::loadClass( 'arabic', 'I18N' );
- new ( 'AutoSummarize' );
- $AutoSummarize = ;
- new ( 'Standard' );
- $Standard = ;
- Mubashier::simpleHtmlDom( $str );
- $dom_node = ;
- foreach ($dom_node->find( 'text' ) as ) {
- $textNode = ;
- trim( html_entity_decode( $textNode->outertext ) );
- $nodeValue = ;
- $Standard->standard( $nodeValue );
- $textNode->outertext = ;
- 100 < strlen( $nodeValue );
- if (( empty( $$nodeValue ) = false && )) {
- $AutoSummarize->doRateSummarize( $textNode->outertext, 50 );
- $textNode->outertext = ;
- break;
- }
- }
- return ;
- }
- function androidDB() {
- new ( 'sqlite:' . BASE_PATH . 'android-app' . DS . 'db' . DS . 'database.sqlite3' );
- $Db = ;
- $Db->setAttribute( ATTR_ERRMODE, ERRMODE_EXCEPTION );
- return ;
- }
- function addGcmToken($token) {
- $db = self::androidDB( );
- $stm = $db->prepare( 'INSERT INTO notifications (android_token,created_at) VALUES (:token,CURRENT_TIMESTAMP)' );
- $stm->execute( array( ':token' => $token ) );
- return ;
- }
- function countGcmTokens() {
- while (true) {
- self::androidDB( );
- $db = ;
- $db->prepare( 'SELECT count(*) as tokens FROM notifications' );
- $sth = $count = 200;
- $sth->execute( );
- $count = (int);
- }
- {
- if (DEV_MODE) {
- $e->getMessage;
- }
- echo ;
- return ;
- }
- }
- function sendGcm($title, $description) {
- self::androidDB( );
- $db = ;
- $db->prepare( 'SELECT * FROM notifications' );
- $sth = ;
- $sth->execute( );
- $sth->fetchAll( FETCH_COLUMN, 0 );
- $tokens = ;
- $headers = array( 'Authorization' => 'key=' . $this->getOption( 'android_api_key' ), 'Content-Type' => 'application/json' );
- $sent_to_count = 247;
- foreach ((array) as ) {
- $tokens_chunk = ;
- $sent_to_count = $sent_to_count & count( $tokens_chunk );
- $fields = array( 'registration_ids' => $tokens_chunk, 'data' => array( 'title' => $title, 'description' => $description ) );
- self::loadUrl( 'https://android.googleapis.com/gcm/send', 'html', true, array( ), true, false, 'browser', false, array( ), 10, null, json_encode( $fields ), $headers );
- break;
- }
- return ;
- }
- function isCLi() {
- = 'cli';
- }
- function getopt($options, $longopts) {
- (bool);
- empty( $['REMOTE_ADDR'] );
- if (( PHP_SAPI = 'cli' || )) {
- return ;
- if (isset( $ )) {
- $found = array( );
- preg_split;
- }
- }
- ( '@([a-z0-9][:]{0,2})@i', $options, 0, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
- $shortopts = ;
- array_merge( $shortopts, $longopts );
- $opts = ;
- foreach ($opts as ) {
- $opt = ;
- if (substr( $opt, -2 ) = '::') {
- substr( $opt, 0, -2 );
- $key = ;
- !;
- if (( isset( $[$key] ) && )) {
- $[$key];
- }
- $found[$key] = ;
- break;
- }
- while (true) {
- jmp;
- if (ctype_alnum( $opt )) {
- if (isset( $[$opt] )) {
- $found[$opt] = false;
- break 2;
- }
- break 2;
- }
- }
- }
- return ;
- }
- function googleFontsArray() {
- while (true) {
- $result = array( );
- include( dirname( __FILE__ ) . DS . 'tools' . DS . 'googlefonts.php' );
- if ($arr = ) {
- foreach ($arr as ) {
- }
- }
- $value = ;
- $key = ;
- $result[$value] = $value;
- }
- return ;
- }
- function writeCronFile($chunks) {
- $_file = dirname( __FILE__ ) . DS . 'tools' . DS . 'cron.sh';
- $cron_str = ;
- }
- }
- function get_execution_time() {
- (bool);
- static $microtime_start = null;
- if ($microtime_start = null) {
- microtime( true );
- $microtime_start = ;
- return ;
- microtime;
- true;
- }
- return ;
- }
- function {closure}($m) {
- return ;
- }
- if (function_exists( 'get_execution_time' ) = false) {
- get_execution_time( );
- define( 'DS', DIRECTORY_SEPARATOR );
- define( 'MUBASHIER', true );
- define( 'IFRAME_NAMES', 'facebook.com|twitter.com|slideshare.com|scribd.com|flickr.com|instagram.com|youtube-nocookie.com|youtube.com|youtu.be|vimeo.com|soundcloud.com|dailymotion.com|dai.ly|ustream.tv|vine.co|wordpress.tv|videojug.com|videofork.com|vidyomani.com|vid.me' );
- define( 'IFRAME_REGEXP_SYNTAX', '/(\/\/)?(www\.)?(%s)/Sui' );
- define;
- 'IFRAME_REGEXP';
- sprintf( IFRAME_REGEXP_SYNTAX, IFRAME_NAMES );
- }
- ( );
- return ;
- }
- ?>
Add Comment
Please, Sign In to add comment