Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php $_stopwatch=microtime(); define('E2_VERSION',3572); define('E2_RELEASE','2.9'); de..

Decoded Output download

<?php 
 $_stopwatch=microtime(); define('E2_VERSION',3572); define('E2_RELEASE','2.9'); define('E2_UA_STRING','E2 (v'. E2_VERSION .'; Aegea)'); define('E2_MINIMUM_PHP','5.4'); define('E2_MINIMUM_MYSQL',4.1); define('BUILDER_OBFUSCATE',1); define('BUILDER_FLATTEN',1); define('E2_NEW_FILES_RIGHTS',0777); define('E2_JSON_STYLE',JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); define('E2_RUN_ID',chr(rand(65,90))); define('HSC_ENC','UTF-8'); define('SECONDS_IN_A_MINUTE',60); define('SECONDS_IN_AN_HOUR',3600); define('SECONDS_IN_A_DAY',86400); define('SECONDS_IN_A_MONTH',2592000); define('SECONDS_IN_A_YEAR',31536000); if(version_compare(PHP_VERSION,E2_MINIMUM_PHP) < 0){ die ('PHP version must be '. E2_MINIMUM_PHP .' or later, you are running '. PHP_VERSION); } if(!function_exists('getimagesize')) { die ('Function getimagesize is not defined, php_gd not installed?'); } if(!function_exists('mb_internal_encoding')) { die ('Function mb_internal_encoding is not defined, php_mbstring not installed?'); } error_reporting(E_ALL); setlocale(LC_CTYPE,'ru_RU.UTF'); mb_internal_encoding('UTF-8'); date_default_timezone_set('GMT'); if(version_compare(PHP_VERSION,'7.0') < 0){ error_reporting(E_ALL & ~E_STRICT); } if(is_file('superconfig.php')) { include 'superconfig.php'; } $_protocol=( !empty ($_SERVER['HTTPS']) && $_SERVER['HTTPS']!=='off' or $_SERVER['SERVER_PORT']==443 or isset ($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO']=='https' or isset ($_SERVER['HTTP_X_HTTPS']) && ($_SERVER['HTTP_X_HTTPS']) ) ? 'https':'http'; if(is_file('force-https')) { $_protocol='https'; } $ra57c1=substr( $_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'],'/index.php') ); list ($x57de2, ) = explode(':',$_SERVER['HTTP_HOST']); $full_blog_url=$_protocol. '://'. $x57de2.$ra57c1; $_user_folder_name=str_replace('/','--',$x57de2.$ra57c1); if(substr($_user_folder_name,0,4)=='www.'){ $_user_folder_name=substr($_user_folder_name,4); } if(is_file('multiuser')) { if ( !empty ($_superconfig) and array_key_exists('rewrites',$_superconfig) and array_key_exists($_user_folder_name,$_superconfig['rewrites']) ) { $_user_folder_name=$_superconfig['rewrites'][$_user_folder_name]; } define('USER_FOLDER','users/'. $_user_folder_name .'/'); } else { define('USER_FOLDER','user/'); } if( !empty ($_superconfig) and array_key_exists('store_files_by_users',$_superconfig) and $_superconfig['store_files_by_users'] ) { define('MEDIA_ROOT_FOLDER',USER_FOLDER .'files/'); } else { define('MEDIA_ROOT_FOLDER',''); } define('EXTRAS_FOLDER',USER_FOLDER.'extras/'); define('BACKUP_FOLDER',USER_FOLDER.'backup/'); define('CACHES_FOLDER',USER_FOLDER.'caches/'); define('USER_LIBRARY_FOLDER',USER_FOLDER.'library/'); define('LOG_FOLDER',USER_FOLDER.'logs/'); define('PICTURES_FOLDER','pictures/'); define('THUMBNAILS_FOLDER','pictures/thumbs/'); define('AVATARS_FOLDER','pictures/avatars/'); define('AUDIO_FOLDER','audio/'); define('TEMPLATES_FOLDER','themes/'); define('SYSTEM_FOLDER','system/'); define('SCRIPTS_FOLDER','system/js/'); define('SYSTEM_LIBRARY_FOLDER','system/library/'); define('SYSTEM_TEMPLATE_FOLDER','system/theme/'); define('AUDIO_ICON_IMAGE','system/theme/images/audio.svg'); define('AUDIO_ICON_WIDTH',80); define('AUDIO_ICON_HEIGHT',80); define('LANGUAGES_FOLDER','system/languages/'); define('DEFAULTS_FOLDER','system/default/'); define('MTMPL_FOLDER','system/default/mail/'); define('DEFAULT_TEMPLATE','plain'); if(!is_file(DEFAULTS_FOLDER. 'config.php')) die ('System config missing'); include DEFAULTS_FOLDER.'config.php'; $_default_config=$_config; if(is_file(USER_FOLDER. 'config.php')) { include USER_FOLDER.'config.php'; $_config=array_merge($_default_config,$_config); } define('E2E_STRANGE_ERROR',10); define('E2E_USER_ERROR',20); define('E2E_PERMISSIONS_ERROR',30); define('E2E_MESSAGE',100); define('E2E_DIAGNOSTICS_MESSAGE',110); define('DEFAULT_ITEMS_PER_PAGE',10); define('MAX_ITEMS_PER_PAGE',100); define('FP_NO_ID_OR_NEW', -1); define('FP_INSERT_ERROR', -10); define('FP_UPDATE_ERROR', -11); define('FP_EMPTY_FIELD', -20); define('FP_TITLE_OR_TEXT_EMPTY', -21); define('FP_NOT_COMMENTABLE', -30); define('FP_COMMENT_DOUBLE_POST', -101); define('FP_COMMENT_TOO_LONG', -102); define('FP_COMMENT_SPAM_SUSPECT', -103); define('NOTE_COMMENTABLE_NOW', -1); define('NOTE_COMMENTABLE_NOW_CONDITIONALLY', -2); define('ENTITY_TYPE_UNSPECIFIED',''); define('ENTITY_TYPE_NOTE','n'); define('ENTITY_TYPE_TAG','t'); define('THUMB_WIDTH',200); define('THUMB_HEIGHT',160); define('THUMB_JPG_QUALITY',90); define('SCALED_IMAGE_JPG_QUALITY',80); define('USERPIC_WIDTH',80); define('USERPIC_HEIGHT',80); define('USERPIC_JPG_QUALITY',95); define('RESOURCES_ALL',0); define('RESOURCES_LOCAL',1); $_fp_error=false; if(strstr(__FILE__,'all.php')) { define('BUILT',0); } else { define('BUILT',1); } function e2_go_to($o56790=''){ global$_protocol,$errors,$x57de2,$ra57c1; @session_start(); $_SESSION['errors']=$errors; if(substr($o56790,0,strlen($_protocol)+3)!=$_protocol .'://'){ header('Location: '. $_protocol .'://'. $x57de2.$ra57c1 .'/'. $o56790); } else { header('Location: '. $o56790); } flush(); return true; } function j4930(){ $k469bb=$_SERVER['HTTP_REFERER']; return e2_go_to($k469bb); } function s4924($o56790){ if($_SERVER['HTTP_REFERER'])$o56790=$_SERVER['HTTP_REFERER']; return e2_go_to($o56790); } function v8c3b($hb2145=''){ $i9dd4e=substr_count($_SERVER['HTTP_HOST'],'.'); $r2cb9d=@str_repeat('_',$i9dd4e).$hb2145; return $r2cb9d; } function ic64a($hb2145,$w2063c='',$fb0b70=true){ $zcd91e=$fb0b70? (time()+3600*24*365) : (0); $rad5f8=$_SERVER['HTTP_HOST']; $ye9c6c=substr_count($rad5f8,'.'); if ($ye9c6c < 3)$rad5f8=str_repeat('.',3-$ye9c6c).$rad5f8; $i9dd4e=setcookie(v8c3b($hb2145),$w2063c,$zcd91e,'/'); } function l163d($p183d6,$fb45cf,$ucadc8=''){ if(trim($fb45cf)!=''){ $fb45cf=explode($p183d6,$fb45cf); foreach ($fb45cf as $f865c0 => $d8ce4b)$fb45cf[$f865c0]=trim($d8ce4b); foreach ($fb45cf as $f865c0 => $d8ce4b) if ($d8ce4b=='') unset ($fb45cf[$f865c0]); $z7b774=array_unique($fb45cf); if ('sort'==$ucadc8)sort($z7b774); return $z7b774; } else return array (); } function l2183($fb45cf){ $te358e=array(); if(is_file(DEFAULTS_FOLDER.'romanize.txt')) { $te358e=file(DEFAULTS_FOLDER.'romanize.txt'); } $dd98a0=$j01b6e=''; foreach ($te358e as $f865c0 => $s6438c){ if (!($f865c0%2))$dd98a0.=rtrim($s6438c) .' '; else $j01b6e.=rtrim($s6438c) .' '; if ($f865c0%2){ while (mb_strlen($j01b6e) < mb_strlen($dd98a0))$j01b6e.=' '; while (mb_strlen($j01b6e) > mb_strlen($dd98a0))$dd98a0.=' '; } } $k60ae1=''; $wde2e7=-1; for ($f865c0=0; $f865c0 < mb_strlen($dd98a0); ++ $f865c0){ $c4a8a0=mb_substr($dd98a0,$f865c0,1); if ($c4a8a0!=' '){ $k60ae1.=$c4a8a0; if ($wde2e7 == -1)$wde2e7=$f865c0; } elseif ($k60ae1){ $w52ac1=trim(mb_substr($j01b6e,$wde2e7,mb_strpos($j01b6e,' ',$wde2e7+1)-$wde2e7)); $n33c9b=array ($k60ae1,$w52ac1); $fce83f[mb_strlen($k60ae1)][] = $n33c9b; $k60ae1=''; $wde2e7=-1; } } $y1d78d=array(); for ($f865c0=count($fce83f); $f865c0 > 0; -- $f865c0){ foreach ($fce83f[$f865c0] as $n33c9b)$y1d78d[$n33c9b[0]] = $n33c9b[1]; } return strtr($fb45cf,$y1d78d); } function te1e7($ocdaee,$action,$u4a202){ if (!is_array($ocdaee))$ocdaee=array(); if($action=='add'){ $ocdaee=array_unique(array_merge($ocdaee,$u4a202)); } if($action=='remove'){ unset ($ocdaee[array_search($u4a202,$ocdaee)]); } if (!is_array($ocdaee))$ocdaee=array(); return $ocdaee; } function r705b($s8d777){ $parameters=$s8d777['parameters']; $gd1fc8=[ 'success' => false ]; try { $s8d777['flipping-function'] ($parameters); $u67142=$parameters; $u67142['value'] = !$parameters['value']; $gd1fc8=[ 'success' => true, 'data' => [ 'flag-now-on' => ($parameters['value']==1), 'new-href' => x83c8($s8d777['candy-name'],$u67142), ] ]; } catch (AeMySQLException $e){ b12f6($e,'Could not set '. $s8d777['flag-name'] .' flag'); } if(array_key_exists('result',$_POST) and ($_POST['result']=='ajaxresult')) { $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } else { e2_go_to(x83c8('e2m_tag',$parameters)); die; } } function xbb8d($fb45cf){ $y5269f=@$_SERVER['HTTP_USER_AGENT'] or $y5269f=''; $x8f0c7=strstr($y5269f,'iPhone') || strstr($y5269f,'iPad'); $j8bf10=strstr($y5269f,'Macintosh'); if ($x8f0c7) return ''; if ($fb45cf=='submit'){ if ($j8bf10){ return '&#x2303; &#x21a9;'; } else { return 'Ctrl + Enter'; } } if ($fb45cf=='livesave'){ if ($j8bf10){ return '&#x2318; S'; } else { return 'Ctrl + S'; } } if ($fb45cf=='navigation'){ if ($j8bf10){ return '&#x2325;'; } else { return 'Ctrl'; } } if ($fb45cf=='navigation-later'){ if ($j8bf10){ return '&#x2325; &uarr;'; } else { return 'Ctrl + &uarr;'; } } if ($fb45cf=='navigation-earlier'){ if ($j8bf10){ return '&#x2325; &darr;'; } else { return 'Ctrl + &darr;'; } } } function f7b91($a1cb25){ $a1cb25=str_replace('<','&lt;',$a1cb25); $a1cb25=str_replace('>','&gt;',$a1cb25); return $a1cb25; } function pc4b6($a1cb25){ $a1cb25=str_replace('"','&quot;',$a1cb25); return $a1cb25; } function yd056($w2063c,$m5d6db){ return str_replace('.',',',round($w2063c,$m5d6db)); } function e2_stripslashes_array($cf1f71){ return is_array($cf1f71)?array_map('e2_stripslashes_array',$cf1f71):stripslashes($cf1f71); } function oabdd(){ if(version_compare(PHP_VERSION,'7.4') >= 0) return; if(get_magic_quotes_runtime()) { set_magic_quotes_runtime(0); } if(get_magic_quotes_gpc()) { $_GET=e2_stripslashes_array($_GET); $_POST=e2_stripslashes_array($_POST); $_COOKIE=e2_stripslashes_array($_COOKIE); $_REQUEST=e2_stripslashes_array($_REQUEST); } } function g0786($r957b5){ return sprintf('%u',ip2long($r957b5)); } function r7c85($ib1bc2){ return long2ip(sprintf('%d',$ib1bc2)); } function e2_decline_for_number($a1cb25,$ib1bc2=null){ $p2f713=$a1cb25; if ($ib1bc2===null){ $ib1bc2=substr($a1cb25,0,strpos($a1cb25,' ')); $p2f713=substr($a1cb25,strpos($a1cb25,' ')+1); } $mf07c9=strpos($p2f713,'('); $e46901=strpos($p2f713,')'); if ($e46901 > $mf07c9)$j22b9f=substr($p2f713,$mf07c9,$e46901-$mf07c9+1); $n93da6=explode(',',trim(@$j22b9f,'()')); if(count($n93da6)==2)array_unshift($n93da6,''); $cc78bd=array (2,0,1,1,1,2,2,2,2,2); if ($ib1bc2%100 > 10 and $ib1bc2%100 < 20)$dcd14c=2; else $dcd14c=$cc78bd[$ib1bc2%10]; $hef3e3=$n93da6[$dcd14c]; $a1cb25=str_replace($j22b9f,$hef3e3,$a1cb25); if(strstr($a1cb25,'(') and strstr($a1cb25,')')) { return e2_decline_for_number($a1cb25,$ib1bc2); } else { return $a1cb25; } } function jc5a6($if2ce1){ $k87e9e=glob($if2ce1,GLOB_NOSORT); if(is_array($k87e9e)) { foreach ($k87e9e as $j435ed){ @unlink($j435ed); } } } function a74dc($d73600){ $k87e9e=glob($d73600 .'*',GLOB_NOSORT); if(is_array($k87e9e)) { foreach ($k87e9e as $j435ed){ if(basename($j435ed)!='.' and basename($j435ed)!='..'){ if(is_dir($j435ed)) { if (a74dc($j435ed .'/')) { if (!rmdir($j435ed)) { return false; } } else { return false; } } else { @unlink($j435ed); } } } return true; } else { return false; } } function eaf42($dd6fe1){ $dd6fe1=trim($dd6fe1,'/'); $dd6fe1=explode('/',$dd6fe1); $d73600=''; foreach ($dd6fe1 as $v83878){ $d73600=$d73600.$v83878; if (!is_dir($d73600)) { if (@mkdir($d73600)) { @chmod($d73600,E2_NEW_FILES_RIGHTS); } else { return false; } } $d73600=$d73600.'/'; } return true; } function e4d36($dd6fe1){ return preg_replace('/\/([^\/]+?)\/\.\./','',$dd6fe1); } function yce9b($fb45cf){ $icee6f=get_html_translation_table(HTML_ENTITIES); $icee6f=array_flip($icee6f); return strtr($fb45cf,$icee6f); } function v7f78($u32c11=NULL){ if(NULL==$u32c11)$u32c11=microtime(); list ($q6021b,$l74459)=explode(' ',$u32c11); return ((float)$q6021b + (float)$l74459); } function r74e0(){ global$settings; if (!isset ($settings))$settings=array(); $cfa816=array(); if(is_file(USER_FOLDER.'settings.json')) { $cfa816=json_decode(file_get_contents(USER_FOLDER.'settings.json'),true); $q098f6=13; } elseif(is_file(USER_FOLDER.'settings.psa')) { $cfa816=unserialize(file_get_contents(USER_FOLDER.'settings.psa')); } if (!is_array($cfa816))$cfa816=array(); $settings=array_merge($settings,$cfa816); if ( !array_key_exists('appearance',$settings) or !array_key_exists('notes_per_page',$settings['appearance']) or !is_numeric($settings['appearance']['notes_per_page']) or $settings['appearance']['notes_per_page'] < 1 ){ $settings['appearance']['notes_per_page']=DEFAULT_ITEMS_PER_PAGE; } if($settings['appearance']['notes_per_page'] > MAX_ITEMS_PER_PAGE){ $settings['appearance']['notes_per_page']=MAX_ITEMS_PER_PAGE; } if ( !array_key_exists('comments',$settings) or !array_key_exists('default_on', @$settings['comments']) ) { $settings['comments']['default_on']=false; } return true; } function e2m_settings(){ global$settings,$_template,$_strings; $rf3e33=array(); $g5e107=DEFAULT_LANGUAGE; if(array_key_exists('language',$settings)) { $g5e107=$settings['language']; } foreach(glob(LANGUAGES_FOLDER. '*.php') as $j435ed){ $r5b54c=substr(basename($j435ed),0,2); $b98bf7=file_get_contents($j435ed); if(preg_match( '/^ *\/\/ *display_name *\= *(.*?) *$/ismu',$b98bf7,$j9c28d )) { $yc2657=$j9c28d[1]; } else { $yc2657=$r5b54c; } $rf3e33[$r5b54c] = array ( 'selected?' => (bool) ($g5e107==$r5b54c), 'display-name' => $yc2657, ); } $r2cb9d['title']=$_strings['pt--settings']; $r2cb9d['heading']=$_strings['pt--settings']; $r2cb9d['form']='form-preferences'; $r2cb9d['form-preferences'] = array ( 'blog-title-default' => htmlspecialchars($_strings['e2--default-blog-title'],ENT_COMPAT,HSC_ENC), 'blog-title' => htmlspecialchars(n6f51(),ENT_COMPAT,HSC_ENC), 'blog-description' => htmlspecialchars(@$settings['description'],ENT_COMPAT,HSC_ENC), 'blog-author-default' => htmlspecialchars($_strings['e2--default-blog-author'],ENT_COMPAT,HSC_ENC), 'blog-author' => htmlspecialchars(@$settings['author'],ENT_COMPAT,HSC_ENC), 'languages' => $rf3e33, 'language' => $g5e107, 'form-action' => x83c8('e2s_settings_save'), 'userpic-href' => f2461('square'), 'notes-per-page' => $settings['appearance']['notes_per_page'], 'email-notify?' => (bool) @$settings['notifications']['new_comments'], 'email' => htmlspecialchars(@$settings['user']['email'],ENT_NOQUOTES,HSC_ENC), 'comments-default-on?' => (bool) @$settings['comments']['default_on'], 'comments-require-gip?' => (bool) @$settings['comments']['require_gip'], 'comments-fresh-only?' => (bool) @$settings['comments']['fresh_only'], 'show-view-counts?' => (bool)$settings['appearance']['show_view_counts'], 'show-sharing-buttons?' => (bool)$settings['appearance']['show_sharing_buttons'], 'includes-google-analytics?' => false, 'includes-yandex-metrika?' => false, 'template-name' => $_template['name'], 'templates' => k94dd(), 'respond-to-dark-mode?' => (bool) @$settings['appearance']['respond_to_dark_mode'], 'submit-text' => $_strings['fb--save-changes'], 'space-usage' => zaf64(yd10e(),true), ); return $r2cb9d; } function e2s_settings_save(){ global$settings,$_strings; if($_SERVER['REQUEST_METHOD']!='POST') return e2_go_to(x83c8('e2m_settings')); $d05df2=$f67daf=''; if(array_key_exists('blog-title',$_POST)) { $d05df2=trim($_POST['blog-title']); } if(array_key_exists('blog-description',$_POST)) { $f67daf=trim($_POST['blog-description']); } if(array_key_exists('blog-author',$_POST)) { $j02bd9=trim($_POST['blog-author']); } if(array_key_exists('language',$_POST)) $k8512a=$_POST['language']; if(array_key_exists('email',$_POST)) $a0c83f=trim($_POST['email']); $y0c2bd=(int)$_POST['notes-per-page']; $settings['site_title']=$d05df2; $settings['site_title']=n6f51(); $settings['author']=$j02bd9; $settings['user']['email']=$a0c83f; $settings['notifications']['new_comments'] = isset ($_POST['email-notify']); if(array_key_exists('template',$_POST)) { $settings['template']=trim($_POST['template']); } $settings['comments']['default_on'] = isset ($_POST['comments-default-on']); $settings['comments']['require_gip'] = isset ($_POST['comments-require-gip']); $settings['appearance']['show_view_counts'] = isset ($_POST['show-view-counts']); if ( !array_key_exists('language',$settings) or $settings['language']!=$k8512a or $settings['description']!=$f67daf or $settings['appearance']['notes_per_page']!=$y0c2bd or $settings['appearance']['show_sharing_buttons'] != isset ($_POST['show-sharing-buttons']) or $settings['appearance']['respond_to_dark_mode'] != isset ($_POST['respond-to-dark-mode']) or $settings['comments']['fresh_only'] != isset ($_POST['comments-fresh-only']) ) { @unlink(CACHE_FILENAME_FRONTPAGE); @unlink(CACHE_FILENAME_FRONTPAGE_FEED); @unlink(CACHE_FILENAME_FRONTPAGE_AUTHOR); $settings['description']=$f67daf; $settings['language']=$k8512a; $settings['appearance']['notes_per_page']=$y0c2bd; $settings['appearance']['show_sharing_buttons'] = isset ($_POST['show-sharing-buttons']); $settings['appearance']['respond_to_dark_mode'] = isset ($_POST['respond-to-dark-mode']); $settings['comments']['fresh_only'] = isset ($_POST['comments-fresh-only']); } jc5a6(CACHE_FILENAMES_NOTES_COMMENTS); if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { q8a40($_strings['er--settings-not-saved'],E2E_PERMISSIONS_ERROR); e2_go_to(x83c8('e2m_settings')); die; } e2_go_to(x83c8('e2m_frontpage', array ('page' => 1))); die; } function e2m_database(){ global$settings,$_strings,$_superconfig; if (@$_superconfig['disallow_db_config']) { return e2_error404_mode(); } $r2cb9d['title']=$_strings['pt--database']; $r2cb9d['heading']=$_strings['pt--database']; $r2cb9d['form']='form-database'; $r2cb9d['form-database'] = array ( 'form-action' => x83c8('e2s_database_save'), 'db-server' => htmlspecialchars(@$settings['db']['server']? $settings['db']['server']:'localhost'), 'db-user' => htmlspecialchars(@$settings['db']['user_name']? $settings['db']['user_name']:'root'), 'db-password' => htmlspecialchars(iee85(@$settings['db']['passw'])), 'db-database' => htmlspecialchars(@$settings['db']['name']), 'submit-text' => $_strings['fb--connect-to-this-db'], ); return $r2cb9d; } function e2s_database_save(){ global$settings,$_db,$_superconfig,$_strings,$_config; if($_SERVER['REQUEST_METHOD']!='POST') return e2_go_to(x83c8('e2m_database')); if (@$_superconfig['disallow_db_config']) { return e2_error404_mode(); } $d78940['server'] = @$_POST['db-server']; $d78940['user_name'] = @$_POST['db-user']; $d78940['passw'] = n1305(@$_POST['db-password']); $d78940['name'] = @$_POST['db-database']; $pad3da=false; try { q985b('check database from HTTP post',$d78940); $aaae42=e2_model_data_check($d78940['name']); if (!$aaae42['occupied'] or !$aaae42['migrateable']) { q8a40($_strings['er--db-data-incomplete']); e2_go_to(x83c8('e2m_database')); die; } cbb8d(); $pad3da=true; } catch (AeMySQLCannotConnectException $e){ q8a40( $_strings['er--cannot-connect-to-db']. ':<br />'. mysqli_connect_error() .' ('. mysqli_connect_errno() .')' ); } catch (AeMySQLTooOldException $e){ q8a40(e2l_get_string('er--mysql-version-too-old', [ 'v1' => $_db['version'], 'v2' => E2_MINIMUM_MYSQL, ])); } catch (AeMySQLException $e){ q8a40($_strings['er--cannot-find-db'] .' '. $d78940['name']); } if (!$pad3da){ e2_go_to(x83c8('e2m_database')); die; } $settings['db']=$d78940; if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { q8a40($_strings['er--settings-not-saved'],E2E_PERMISSIONS_ERROR); e2_go_to(x83c8('e2m_database')); die; } e2_drop_all_kinds_of_cache(); if (!$_config['retain_search_indexes_on_db_switch']) { $fddece=a476c(); try { $fddece -> erase(); } catch (\S2\Rose\Exception\RuntimeException $e){ if(Log::$ned2b5)__log('Rose not available'); } c198f(); } gcc38(x83c8('e2s_bsi_step')); e2_go_to(x83c8('e2m_settings')); die; } function rda67(){ return class_exists('ZipArchive'); } function e2m_get_backup(){ if (rda67()) { $vfbade=new ZipArchive(); $r979eb=BACKUP_FOLDER .'backup.zip'; if ($vfbade -> open($r979eb,ZIPARCHIVE::CREATE)) { @ $vfbade -> addEmptyDir('backup'); @ $vfbade -> addEmptyDir('backup/db'); @ $vfbade -> addFile(USER_FOLDER.'[email protected]','backup/files/[email protected]'); @ $vfbade -> addFile(USER_FOLDER.'[email protected]','backup/files/[email protected]'); foreach(glob(BACKUP_FOLDER .'backup-*.sql') as $d8c7dd); $vfbade -> addFile($d8c7dd,'backup/db/'. basename($d8c7dd)); $vfbade -> close(); } if(is_file($r979eb)) { header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="backup.zip"'); readfile($r979eb); unlink($r979eb); } else { die ('Cannot get backup'); } die; } else { die ('Cannot get backup'); } } if(substr(@$_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2)=='ru'){ define('DEFAULT_LANGUAGE','ru'); } else { define('DEFAULT_LANGUAGE','en'); } function e2l_get_string($bfa206,$s8d777){ global$_strings; $vb0689=$_strings[$bfa206]; if(preg_match_all('/\$\[(.+?)\]/u',$vb0689,$j9c28d,PREG_SET_ORDER)) { foreach ($j9c28d as $pe3cc9){ $hb2145=$pe3cc9[1]; $af2ffc=''; if(strstr($hb2145,'.')) list ($hb2145,$af2ffc)=explode('.',$hb2145,2); if(array_key_exists($hb2145,$s8d777)) { if ($af2ffc){ $vb0689=str_replace($pe3cc9[0],e2l__format_value($af2ffc,$s8d777[$hb2145],$bfa206),$vb0689); } else { $vb0689=str_replace($pe3cc9[0],$s8d777[$hb2145],$vb0689); } } } } return $vb0689; } function e2l__format_value($af2ffc,$w2063c,$bfa206){ list ($af2ffc,$t3ad73)=explode('.',$af2ffc,2); $je6875='e2lstr_'. $af2ffc; if(function_exists($je6875)) { return call_user_func($je6875,$w2063c,$t3ad73,$bfa206); } else { return $w2063c; } return $w2063c; } function hfc91(){ global$_lang,$settings; if ( array_key_exists('language',$settings) and is_file($h2d354=LANGUAGES_FOLDER.$settings['language'] .'.php') ) { $_lang=$settings['language']; include $h2d354; } elseif(is_file($h2d354=LANGUAGES_FOLDER.DEFAULT_LANGUAGE .'.php')) { $_lang=DEFAULT_LANGUAGE; include $h2d354; } else { die ('Language file missing: '. $h2d354); } return e2l_load_strings(); } define('LOG_FILE',LOG_FOLDER.'main.log'); define('LOG_DEBUG_FILE',LOG_FOLDER.'debug.log'); class Log { public static $ned2b5=false; public static $e34a72=false; } function r372b(){ global$_config; if ( $_config['write_log'] and ($_config['write_log_create'] or is_file(LOG_FILE)) ) { Log::$ned2b5=true; Log::$e34a72=true; } else { Log::$ned2b5=false; Log::$e34a72=false; } if (!Log::$ned2b5) return; @eaf42(LOG_FOLDER); if($_config['write_log_reset']) { @file_put_contents(LOG_FILE,''); @chmod(LOG_FILE,E2_NEW_FILES_RIGHTS); } if (@$_config['write_log_limit'] and is_file(LOG_FILE)) { $jbc7b3=@stat(LOG_FILE); $jbc7b3=$jbc7b3['size']; if ($jbc7b3 > $_config['write_log_limit']) { @rename(LOG_FILE,LOG_FILE .'.bak'); @chmod(LOG_FILE .'.bak',E2_NEW_FILES_RIGHTS); @file_put_contents(LOG_FILE,''); } } __log(''); } function v714a($q22af6=false) { static $t197b1=false; if ($q22af6===false) return $t197b1; if ($q22af6==='') return $t197b1=false; $j435ed=str_replace( '$',gmdate('Y-m-d-\a\t-H-i-s'),$q22af6 ); return $t197b1= $j435ed; } function __log($a1cb25){ static $r12a05; global$_stopwatch; $td8367=v714a(); $y605ac=''; $paf240=str_pad(round(v7f78()-$_stopwatch,5),10,' ',STR_PAD_RIGHT); if ($a1cb25[0]=='}'){ -- $r12a05; if ($r12a05 < 0)$r12a05=0; } $t8e13f=( E2_RUN_ID .' '. $y605ac .''. $paf240 .' '. str_repeat(' ',$r12a05*2). $a1cb25."\n" ); if ($a1cb25[strlen($a1cb25)-1]=='{'){ ++ $r12a05; } $y15d61=FILE_APPEND; if(Log::$e34a72){ @file_put_contents(LOG_FILE,$t8e13f,$y15d61); @chmod(LOG_FILE,E2_NEW_FILES_RIGHTS); } if ($td8367!==false){ $j435ed=LOG_FOLDER.$td8367 .'.log'; @eaf42(LOG_FOLDER); @file_put_contents($j435ed,$t8e13f,$y15d61); @chmod($td8367,E2_NEW_FILES_RIGHTS); } if ($a1cb25[0]=='#'){ @eaf42(dirname(LOG_DEBUG_FILE). '/'); @file_put_contents(LOG_DEBUG_FILE,$t8e13f,$y15d61); @chmod(LOG_DEBUG_FILE,E2_NEW_FILES_RIGHTS); } } function sce80($r6bf76){ @k6e52( USER_FOLDER .'ctree.php', "<?php\r\n\r\n". var_export($r6bf76,true). "\r\n\r\n?>php" ); } function e2s_log(){ @eaf42(LOG_FOLDER); @file_put_contents(LOG_FILE,''); @chmod(LOG_FILE,E2_NEW_FILES_RIGHTS); die ('Log file created.'); } function q8a40($f67daf,$type=E2E_STRANGE_ERROR){ global$errors,$settings, $_config, $_strings, $_diagnose; if (!isset ($errors))$errors=[]; $o1897a=(!we852()+1 <= (int)$_config['show_call_stack']); if ($f67daf){ if ($f67daf[0]!='<')$f67daf='<p>'.$f67daf .'</p>'; $fcd1dd=array ( 'description' => $f67daf, 'type' => $type, ); if($type==E2E_STRANGE_ERROR and $o1897a){ $fcd1dd['backtrace']=debug_backtrace(); } $errors[] = $fcd1dd; } if($type==E2E_PERMISSIONS_ERROR){ $_diagnose['need?']=true; ic64a('diagnose','1'); } return true; } function k8739(){ global$errors,$e1c0b7,$_strings,$_diagnose; $j7287a=jea70(); if(count($j7287a)==0){ ic64a('diagnose',''); unset($_COOKIE['diagnose']); $_diagnose['need?']=false; $_diagnose['ok?']=true; return true; } else { $i6e2ba=''; $i6e2ba.='<p>'. $_strings['gs--enable-write-permissions-for-the-following'] .'</p>'; $i6e2ba.='<ul>'; foreach ($j7287a as $x8fa14){ if ($x8fa14=='.')$x8fa14=''; $i6e2ba.='<li><tt>./'. $x8fa14 .'</tt></li>'; if(Log::$ned2b5)__log('Diagnostics: cannot write <'. $x8fa14 .'>'); } $i6e2ba.='</ul>'; $fcd1dd=array ( 'title' => $_strings['et--fix-permissions-on-server'], 'description' => $i6e2ba, 'type' => E2E_DIAGNOSTICS_MESSAGE, 'class' => 'serious', ); $errors[] = $fcd1dd; $_diagnose['ok?']=false; return false; } } function we1c4($qc1336,$f67daf,$l1407f,$qc2d4b,$x4f62c){ global$errors; if(0==error_reporting() or ($qc1336 & 8)) return; $l1407f=str_replace(__DIR__,'',$l1407f); q8a40($l1407f .', line '. $qc2d4b .'<br />Error '. $qc1336 .': '. $f67daf); $errors[count($errors)-1]['phpcode']=$qc1336; } function s2982($hf6cdd,$m78e73,$d8c7dd,$s6438c){ if (!(error_reporting() & $hf6cdd)) return; throw new ErrorException($m78e73,0,$hf6cdd,$d8c7dd,$s6438c); } function u0955(){ global$errors,$settings,$_config; if (!isset ($errors))$errors=[]; @session_start(); if(is_array(@$_SESSION['errors'])) { $e=array_merge(@$_SESSION['errors'],$errors); } else { $e=$errors; } $o1897a=(!we852()+1 <= (int)$_config['show_call_stack']); if (@$_config['store_backtrace'] and $o1897a and $e!=NULL){ @k6e52('backtrace.psa',serialize($e)); } else { @unlink('backtrace.psa'); } if (isset ($_SESSION['errors'])) unset($_SESSION['errors']); $r2cb9d=array(); $jb8735=false; if(count($e) > 0){ foreach($e as $f865c0 => $o08a44){ if ($o08a44['type']==E2E_STRANGE_ERROR){ $o08a44['class']='serious'; $jb8735=true; if ($o1897a){ $o08a44['backtrace']=i2616($o08a44['backtrace']); } } if ($o08a44['type']==E2E_MESSAGE){ $o08a44['class']='info'; } $e[$f865c0]=$o08a44; } $r2cb9d['each']=$e; if ( $jb8735 and @$_config['store_backtrace'] and $o1897a and is_file('debug.php') ) { $r2cb9d['debug-link']='debug.php'; } } return $r2cb9d; } function k4006(){ $errors=u0955(); foreach($errors['each'] as $rcb5e1){ echo '<p>'. $rcb5e1['description'] .'</p>'; } die; } function i2616($l69206){ global $ra57c1; if (!is_array($l69206)) return 'No backtrace info'; $l69206=array_reverse($l69206); $l69206=array_splice($l69206,0,count($l69206)-1); $e='<p style="background: #fea; padding: .25em .5em; line-height: 1em; overflow: hidden">'; foreach ($l69206 as $f865c0 => $te358e){ $l195df=@$te358e['args'] or $l195df=array(); $pa956a=array(); foreach ($l195df as $s5919c){ $pa956a[] = var_export($s5919c,true); } $d8c7dd=@$te358e['file']; $d8c7dd=str_replace($_SERVER['DOCUMENT_ROOT'],'',$d8c7dd); $s6438c=(@$te358e['line']? (' #'. $te358e['line']) : '?'); $e.='<div style="margin: .25em 0 .5em '. $f865c0*3 .'em">'; $e.='<span style="float: right; color: #666"> '. $d8c7dd.$s6438c .'</span>'; $e.='<tt><b>'. @$te358e['function'] .' (</b>'; if(count($pa956a)) { $zeb84a=str_replace("array (\n)",'array ()',$pa956a); $zeb84a=implode(', ',$zeb84a); if(0){ $zeb84a=highlight_string('<?'. $zeb84a .'?'.'>',true); $zeb84a=substr($zeb84a,77, -28); } $zeb84a=str_replace('&nbsp;',' ',$zeb84a); $zeb84a=nl2br($zeb84a); $e.='<div style="margin: 0 0 0 1.12em">'. $zeb84a .'</div>'; } $e.='<b>)</b> &rarr;</tt></div>'; } $e.='</p>'; return$e; } class AeException extends \Exception {} class AeMySQLException extends AeException {} class AeMySQLNotFoundException extends AeMySQLException {} class AeMySQLTooOldException extends AeMySQLException {} class AeMySQLCannotConnectException extends AeMySQLException {} class AeMySQLAccessDeniedException extends AeMySQLCannotConnectException {} class AeMySQLQueryException extends AeMySQLException {} class AeMySQLCorruptedUpdateRecordCallException extends AeMySQLException {} class AeInstallException extends AeException {} class AeInstallAlreadyInstalledException extends AeInstallException {} class AeInstallDatabaseOccupiedException extends AeInstallException {} class AeNotSavedException extends AeException {} class AePasswordHashNotSavedException extends AeNotSavedException {} class AeSettingsNotSavedException extends AeNotSavedException {} class AeModelUnknownTableException extends AeException {} class AeOlbaException extends AeException {} class AeOlbaTemplateMissingException extends AeOlbaException {} class AeNotAndCannotBeInstalledException extends AeException {} function od0c8($p42552,$y44fb5=false){ $y5ee24=substr(__DIR__,0,strrpos(__DIR__,'/')); $x70261=''; $b04a75=[]; foreach(array_reverse($p42552 -> getTrace()) as $r447b7){ $xb25b3['where']=str_replace( $y5ee24 .'/','',$r447b7['file'] ) .':'. $r447b7['line']; $g97346=[]; foreach ($r447b7['args'] as $b61dd8){ $g97346[] = htmlspecialchars( str_replace("\n","\n  ",var_export($b61dd8,true)), ENT_NOQUOTES,HSC_ENC ); } $h5eaa0=''; if(count($g97346)) { $h5eaa0=("\n". '  '. implode(",\n  ",$g97346). "\n" ); } $xb25b3['call']=$r447b7['function'] .' ('. $h5eaa0 .')'; $b04a75[] = $xb25b3; } if ((string)$p42552 -> getMessage()!==''){ $x70261.=$p42552 -> getMessage() ."\n"; } $x70261.="\n";; $x70261 .= ( get_class($p42552) .' in '. str_replace( $y5ee24 .'/','',$p42552 -> getFile() ) .':'. $p42552 -> getLine(). "\n" ); if ($p42552 -> getCode()) { $x70261.='Code: '. $p42552 -> getCode() ."\n"; } $g98594=''; $f865c0=1; foreach ($b04a75 as $s6438c){ $g98594.=$f865c0++ .'. '. $s6438c['where'] .' '. $s6438c['call']. "\n"; if (!$y44fb5)$g98594.="\n";; } $x70261.="\n";; if ($y44fb5){ $g98594=preg_replace('/^.*?$/smu','            $0',$g98594); $x70261.=''. "\n"; $x70261.=$g98594; $x70261.=''; } else { $x70261.=$g98594; } return $x70261; } function b12f6($p42552,$m78e73=''){ global$_config; if(__DEV)q8a40('<pre>'. od0c8($p42552) .'</pre>'); if($_config['log_errors']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('error-$'); } if(Log::$ned2b5)__log('Exception caught: '. od0c8($p42552,true)); if(Log::$ned2b5)v714a(''); if ((string)$m78e73!==''){ if(Log::$ned2b5)__log($m78e73); } } function q4aff($p42552){ global$_config,$content,$ra57c1; $content['title']=':-('; if(__DEV)$content['exception-string']=od0c8($p42552); if($_config['log_errors']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('error-$'); } if(Log::$ned2b5)__log('Panic: '. od0c8($p42552,true)); $r2cb9d=q166b('panic',true); if(Log::$ned2b5)__log(':-('); echo $r2cb9d; die; } function maefe($p42552){ q4aff($p42552); } $_url_map=array ( '@build' => 'e2://e2s_build', '@sync' => 'e2://e2s_sync', '@log' => 'e2://e2s_log', '@dump' => 'e2://e2s_dump', '@bsi' => 'e2://e2s_bsi_status', '@bsi/drop' => 'e2://e2s_bsi_drop', '@bsi/step' => 'e2://e2s_bsi_step', '@migrate' => 'e2://e2s_migrate', '@retrieve:url' => 'e2://e2s_retrieve', '@instantiate:version' => 'e2://e2s_instantiate', '@notify' => 'e2://e2s_notify', '@info' => 'e2://e2m_info', '@ajax/::' => 'e2://e2j_::', '@actions/::' => 'e2://e2s_::', '' => 'e2://e2m_frontpage?page=1', ':page' => 'e2://e2m_frontpage', 'rss' => 'e2://e2m_rss', 'json' => 'e2://e2m_json', 'sitemap.xml' => 'e2://e2m_sitemap_xml', ':year' => 'e2://e2m_year', ':year/:month' => 'e2://e2m_month', ':year/:month/:day' => 'e2://e2m_day', 'all' => 'e2://e2m_everything', ':note' => 'e2://e2m_note', ':note/edit' => 'e2://e2m_note_edit?is_published=1', ':note/favourite' => 'e2://e2m_note_flag_favourite?is_published=1&value=1', ':note/unfavourite' => 'e2://e2m_note_flag_favourite?is_published=1&value=0', ':note/show' => 'e2://e2m_note_flag?is_published=1&flag=IsVisible&value=1', ':note/hide' => 'e2://e2m_note_flag?is_published=1&flag=IsVisible&value=0', ':note/discuss' => 'e2://e2m_note_flag?is_published=1&flag=IsCommentable&value=1', ':note/quiet' => 'e2://e2m_note_flag?is_published=1&flag=IsCommentable&value=0', ':note/withdraw' => 'e2://e2m_note_withdraw?is_published=1', ':note/json' => 'e2://e2m_note_json', ':note/broadcast' => 'e2://e2m_note_broadcast', ':note/read' => 'e2://e2m_note_read', ':note/delete' => 'e2://e2m_note_delete?is_published=1', ':note/format/:formatter' => 'e2://e2m_note_use_formatter?is_published=1', ':note/:unsubscr' => 'e2://e2m_unsubscribe?is_published=1', ':note/:comnum' => 'e2://e2m_comment', ':note/:comnum/edit' => 'e2://e2m_comment_edit', ':note/:comnum/important' => 'e2://e2m_comment_flag_ajax?flag=IsFavourite&value=1', ':note/:comnum/usual' => 'e2://e2m_comment_flag_ajax?flag=IsFavourite&value=0', ':note/:comnum/replace' => 'e2://e2m_comment_flag_ajax?flag=IsVisible&value=1', ':note/:comnum/remove' => 'e2://e2m_comment_flag_ajax?flag=IsVisible&value=0', ':note/:comnum/spam' => 'e2://e2m_comment_flag?flag=IsSpamSuspect&value=1', ':note/:comnum/good' => 'e2://e2m_comment_flag?flag=IsSpamSuspect&value=0', ':note/:comnum/wipe' => 'e2://e2m_comment_delete', ':note/:comnum/reply/edit' => 'e2://e2m_comment_reply', ':note/:comnum/reply/important' => 'e2://e2m_comment_flag_ajax?flag=IsReplyFavourite&value=1', ':note/:comnum/reply/usual' => 'e2://e2m_comment_flag_ajax?flag=IsReplyFavourite&value=0', ':note/:comnum/reply/replace' => 'e2://e2m_comment_flag_ajax?flag=IsReplyVisible&value=1', ':note/:comnum/reply/remove' => 'e2://e2m_comment_flag_ajax?flag=IsReplyVisible&value=0', ':note/:comnum/reply/delete' => 'e2://e2m_comment_reply_delete', 'drafts' => 'e2://e2m_drafts', 'drafts/:draft' => 'e2://e2m_draft', 'drafts/:draft/edit' => 'e2://e2m_note_edit?is_published=0', 'drafts/:draft/show' => 'e2://e2m_note_flag?is_published=0&flag=IsVisible&value=1', 'drafts/:draft/hide' => 'e2://e2m_note_flag?is_published=0&flag=IsVisible&value=0', 'drafts/:draft/delete' => 'e2://e2m_note_delete?is_published=0', 'drafts/:draft/format/:formatter' => 'e2://e2m_note_use_formatter?is_published=0', 'drafts/:draft/:preview' => 'e2://e2m_draft_preview', 'sources' => 'e2://e2m_sources', 'sources/:source/trust' => 'e2://e2m_source_trust', 'sources/:source/premoderate' => 'e2://e2m_source_premoderate', 'sources/:source/ban' => 'e2://e2m_source_ban', 'sources/:source/forget' => 'e2://e2m_source_forget', 'tags' => 'e2://e2m_tags', 'tags/:tag' => 'e2://e2m_tag?page=1', 'tags/:tag/:page' => 'e2://e2m_tag', 'tags/:tag/rss' => 'e2://e2m_tag_rss', 'tags/:tag/json' => 'e2://e2m_tag_json', 'tags/:tag/edit' => 'e2://e2m_tag_edit', 'tags/:tag/delete' => 'e2://e2m_tag_delete', 'tags/:tag/pin' => 'e2://e2m_tag_flag_ajax?flag=IsFavourite&value=1', 'tags/:tag/unpin' => 'e2://e2m_tag_flag_ajax?flag=IsFavourite&value=0', 'untagged' => 'e2://e2m_untagged', 'hot' => 'e2://e2m_most_commented', 'selected' => 'e2://e2m_favourites?page=1', 'selected/:page' => 'e2://e2m_favourites', 'found' => 'e2://e2m_found&query=', 'found/:query' => 'e2://e2m_found', 'new' => 'e2://e2m_write', 'install' => 'e2://e2m_install', 'settings' => 'e2://e2m_settings', 'settings/name' => 'e2://e2m_name_and_author', 'settings/database' => 'e2://e2m_database', 'settings/password' => 'e2://e2m_password?recovery-key=', 'settings/password-reset' => 'e2://e2m_password_reset', 'settings/password/:reset' => 'e2://e2m_password', 'settings/timezone' => 'e2://e2m_timezone', 'settings/sessions' => 'e2://e2m_sessions', 'settings/theme-preview' => 'e2://e2m_theme_preview?theme=', 'settings/theme-preview/:theme' => 'e2://e2m_theme_preview', 'settings/get-backup' => 'e2://e2m_get_backup', 'sign-in' => 'e2://e2m_sign_in', 'sign-out' => 'e2://e2m_sign_out', 'sign-in/:provider' => 'e2://e2m_gip_sign_in', 'sign-out/:provider' => 'e2://e2m_gip_sign_out', 'sign-in-done/:provider' => 'e2://e2m_gip_sign_in_callback', ); $_url_chunks=array ( '\:page' => 'page\-(?P<page>\d+)', '\:year' => '(?P<year>\d{4})', '\:month' => '(?P<month>\d{1,2})', '\:day' => '(?P<day>\d{1,2})', '\:note' => array ( 'all\/(?P<alias>[-a-zA-Z0-9]+)', '(?P<year>\d{4})\/(?P<month>\d{1,2})\/(?P<day>\d{1,2})\/(?P<day_number>\d+)', ), '\:draft' => array ( '(?P<oalias2>[-a-zA-Z0-9]+)\/(?P<draft2>\d+)', '(?P<oalias>[-a-zA-Z0-9]+)', '-\/(?P<draft>\d+)', ), '\:comnum' => 'comment\-(?P<comment_number>[0-9]+)', '\:file' => '(?P<file>.*?)', '\:tag' => '(?P<tag_alias>[-a-zA-Z0-9,]+)', '\:query' => '(?P<query>.*?)', '\:provider' => '(?P<provider>.*?)', '\:version' => '\:(?P<version>\d+)', '\:source' => '\:(?P<source>.*?)', '\:picture' => '\:(?P<picture>.*?)', '\:unsubscr' => 'unsubscribe\:(?P<unsubscribe_email>.+?)\:(?P<unsubscribe_key>[0-9a-f]{32})', '\:reset' => 'reset\:(?P<recovery_key>[0-9a-f]{40})', '\:formatter' => '(?P<formatter>.*?)', '\:alias' => '(?P<newalias>[-a-zA-Z0-9]+)', '\:preview' => 'preview\:(?P<preview_key>[0-9a-f]{32})', '\:theme' => '(?P<theme>[-a-zA-Z0-9]+)', '\:source' => '(?P<source>\d+)', '\:url' => '\:(?P<url>[a-zA-Z0-9]+\=)', ); $_url_autoredirects=array ( '/^favo(?:u?)rites(\~.+)?$/i' => 'selected\\1', '/^favo(?:u?)rites\/(.+)/i' => 'selected/\\1', '/^keywords$/i' => 'tags', '/^keywords\/(.*)/i' => 'tags/\\1', '/^everything$/i' => 'all', '/^search\/(.+)/i' => 'found/\\1', '/^(\d{4}\/\d{1,2}\/\d{1,2}\/\d+)\/comments(\/?)$/i' => '\\1', '/^\~(\d+)/i' => 'page-\\1', '/\/?\~(\d+)/i' => '/page-\\1', ); function zb6b0($t572d4){ global$_url_autoredirects,$ra57c1; $t572d4=preg_replace(array_keys($_url_autoredirects),array_values($_url_autoredirects),$t572d4); if(preg_match('/^([0-9]+)[.-]([0-9]+)[.-]([0-9]+)(.*)/',$t572d4,$j9c28d)) { if(2==strlen($j9c28d[3]))$j9c28d[3]='20'.$j9c28d[3]; return ($j9c28d[3].'/'.$j9c28d[2].'/'.$j9c28d[1].$j9c28d[4]); } if(preg_match('/^tags\-rss\/(.*?)\/?$/',$t572d4,$j9c28d)) { $le4d23=substr($j9c28d[1],strrpos($j9c28d[1],'/')+1); return ('tags/'. $le4d23.'/rss/'); } return $t572d4; } function j7059(){ static $s6b2de=false; global$__synthetic_urls,$_config,$_superconfig; if ($s6b2de) return; $id0e31=$_config['url_composition']; if (!empty ($_superconfig) and array_key_exists('url_composition',$_superconfig)) { $id0e31=$_superconfig['url_composition']; } $__synthetic_urls=false; if ($id0e31=='synthetic'){ $__synthetic_urls=true; } if ($id0e31=='auto'){ if(function_exists('apache_get_modules')) { if(in_array('mod_rewrite',apache_get_modules())) { $__synthetic_urls=true; } } } $s6b2de=true; } function x83c8($uc48ba,$parameters=array ()) { global$_url_map,$_url_chunks,$_config,$__synthetic_urls,$_protocol,$x57de2,$ra57c1; $xc2bd7=array_flip($_url_map); if ( @$_config['preferred_domain_name'] and $_SERVER['HTTP_HOST']!=$_config['preferred_domain_name'] ) { $x57de2=$_config['preferred_domain_name']; } $t572d4=$_protocol .'://'. $x57de2.$ra57c1 .'/'; $h9c464='e2://'. $uc48ba; if(array_key_exists('page',$parameters)) { $e71860=$parameters['page']; } else { $e71860=1; } if($parameters){ $h9c464.='?'; $z1c61f=array(); $v21711=array(); foreach($parameters as $b3c6e0 => $w2063c){ if ($b3c6e0=='*note'){ $v21711[] = $b3c6e0; $z1c61f[] = e2urls__expand_tricky_parameters_for_note_($w2063c); } if ($b3c6e0=='*tags'){ $v21711[] = $b3c6e0; $z1c61f[] = e2urls__expand_tricky_parameters_for_tags_($w2063c); } if ($b3c6e0=='*tag'){ $v21711[] = $b3c6e0; $z1c61f[] = e2urls__expand_tricky_parameters_for_tags_(array ($w2063c)); } } foreach ($v21711 as $b3c6e0) unset($parameters[$b3c6e0]); foreach ($z1c61f as $p58e2a){ $parameters=array_merge($parameters,$p58e2a); } foreach($parameters as $b3c6e0 => $w2063c){ if (@$b3c6e0[0]!='_'){ $h9c464.=$b3c6e0 .'='. urlencode($w2063c) .'&'; } } $h9c464=substr($h9c464,0, -1); } if ($uc48ba=='e2m_draft' and $parameters['is-published']===1)$uc48ba='e2m_note'; if ($uc48ba=='e2m_note' and $parameters['is-published']===0)$uc48ba='e2m_draft'; if(array_key_exists($h9c464,$xc2bd7)) { if ($xc2bd7[$h9c464]!=='')$t572d4.=$xc2bd7[$h9c464] .'/'; return $t572d4; } else { $w44907=false; foreach ($xc2bd7 as $e45ea8 => $n9ea44){ $yb7365=$e45ea8; $yb7365=preg_quote($yb7365,'/'); $oed015=parse_url($e45ea8); $y2f532=$oed015['host']; $kebe09=parse_url($h9c464); if(strstr($e45ea8,'::')) { $offd6b=$kebe09['scheme'] .'://'. $kebe09['host']; $yb7365=str_replace('\:\:','(.*)',$yb7365); $yb7365='/^'. $yb7365 .'$/s'; if(preg_match($yb7365,$offd6b,$j9c28d)) { $dd6fe1=str_replace('::',$j9c28d[1],$n9ea44); $dd6fe1=str_replace('_','-',$dd6fe1); $b1b1cc=$kebe09['query']; if($__synthetic_urls and $b1b1cc){ $t572d4.=$dd6fe1 .'/?'. $b1b1cc; } elseif($__synthetic_urls){ $t572d4.=$dd6fe1 .'/'; } elseif ($b1b1cc){ $t572d4.='?go='. $dd6fe1 .'/?'. $b1b1cc; } else { $t572d4.='?go='. $dd6fe1 .'/'; } return $t572d4; } } $m54435=false; if ($uc48ba===$y2f532){ $w44907=true; if ($oed015['query']) { $j22c38=explode('&',$oed015['query']); foreach ($j22c38 as $m8822b){ list ($b3c6e0,$w2063c)=explode('=',$m8822b); $w2063c=urldecode($w2063c); $b3c6e0=str_replace('_','-',$b3c6e0); if ( array_key_exists($b3c6e0,$parameters) and $parameters[$b3c6e0]!=$w2063c ){ $m54435=true; break; } } } if (!$m54435){ if(preg_match_all('/\:[\-a-z]+/i',$n9ea44,$j9c28d)) { foreach ($j9c28d[0] as $tfc413){ $ob0f75=$_url_chunks['\\'. $tfc413]; if (!is_array($ob0f75)) { $ob0f75=array ($ob0f75); } $n05f62=$ob0f75[0]; foreach ($ob0f75 as $n05f62){ $weab03='/\(\?P\<(.*?)\>.*?\)/'; $p4274e=true; if (@preg_match_all($weab03,$n05f62,$j9c28d)) { $j9c28d=$j9c28d[1]; $p4274e=true; for ($f865c0=0; $f865c0 < count($j9c28d); ++ $f865c0){ if ( !array_key_exists(str_replace("_","-",$j9c28d[$f865c0]), $parameters) or $parameters[str_replace("_","-",$j9c28d[$f865c0])] === '' ){ $p4274e=false; break; } } } if (!$p4274e) continue; $sf9e1e=@preg_replace_callback( $weab03, function ($j9c28d) use ($parameters){ return$parameters[str_replace("_","-",$j9c28d[1])]; }, $n05f62 ); $sf9e1e=stripslashes($sf9e1e); $nc5d91=str_replace($tfc413,$sf9e1e,$n9ea44); break; } $n9ea44=$nc5d91; } } $x15214=array(); if ($n9ea44){ if($__synthetic_urls){ $t572d4.=$n9ea44 .'/'; } else { $x15214[] = 'go='. $n9ea44 .'/'; } } foreach($_GET as $d8ce4b => $t9e366) if(in_array($d8ce4b, array ('result','themeless'))) { $x15214[] = $d8ce4b . ($t9e366? ('='. urlencode($t9e366)) : ''); } if(count($x15214)) { $t572d4.='?'. implode('&',$x15214); } return $t572d4; } } } if ($w44907){ return $t572d4; } else { die ('Cannot compose url for candy '. $uc48ba); } } } function sb7e9($t572d4=null){ global$_url_map,$_url_chunks,$_config,$_current_url,$__synthetic_urls,$_protocol,$x57de2,$ra57c1; if ($t572d4===null) $t572d4=urldecode($_GET['go']); if(Log::$ned2b5)__log('Resolve "'. $t572d4 .'"'); j7059(); $q196c2=$t572d4; $t572d4=trim($t572d4,'/'); $t572d4=zb6b0($t572d4); $parameters=array(); foreach($_url_map as $p12a24 => $e45ea8){ $od532d=$p12a24; $od532d=preg_quote($od532d,'/'); if(strstr($p12a24,'::')) { $od532d=str_replace('\:\:','(.*)',$od532d); $od532d='/^'. $od532d .'$/s'; if(preg_match($od532d,$t572d4,$j9c28d)) { $b53b9e=str_replace('-','_',$j9c28d[1]); $h9c464=str_replace('::',$b53b9e,$e45ea8); } } elseif(strstr($p12a24,':')) { $y1e380=array(); foreach($_url_chunks as $d8ce4b => $t9e366){ if(is_array($t9e366)) { $y1e380[$d8ce4b]='(?:(?:'. implode(')|(?:',$t9e366) .'))'; } else { $y1e380[$d8ce4b]=$t9e366; } } $od532d=str_replace( array_keys($y1e380), array_values($y1e380), $od532d ); $od532d='/^'. $od532d .'$/s'; if(preg_match($od532d,$t572d4,$j9c28d)) { $h9c464=$e45ea8; foreach ($j9c28d as $b3c6e0 => $w2063c) if (!is_numeric($b3c6e0)) { $b3c6e0=str_replace('_','-',$b3c6e0); $parameters[$b3c6e0]=$w2063c; } } } else { if ($p12a24==$t572d4){ $h9c464=$e45ea8; break; } } } $yfafdd=(bool)$h9c464; if (!$h9c464)$h9c464='e2://e2_error404_mode'; $kebe09=parse_url($h9c464); $uc48ba=$kebe09['host']; if ($kebe09['query']) { $j22c38=explode('&',$kebe09['query']); foreach ($j22c38 as $m8822b){ list ($b3c6e0,$w2063c)=explode('=',$m8822b); $w2063c=urldecode($w2063c); $b3c6e0=str_replace('_','-',$b3c6e0); $parameters[$b3c6e0]=$w2063c; } } $r2cb9d=false; $parameters=e2urls__consolidate_tricky_parameters_($parameters); if ($yfafdd){ if($_config['force_canonical_urls']) { foreach (['draft2','oalias2'] as $cf4975){ if(array_key_exists($cf4975,$parameters)) { unset($parameters[$cf4975]); } } $k95d32=x83c8($uc48ba,$parameters); list ($pa4c3a,$wab96c)=explode('?',$_SERVER['REQUEST_URI'],2); $wa37bf=$_protocol .'://'.$_SERVER['HTTP_HOST'].$pa4c3a; $h5d6ba=$_protocol .'://'.$_SERVER['HTTP_HOST'].urldecode($pa4c3a); $wab96c=explode('&',$wab96c); foreach ($wab96c as $m6c0d0){ list ($j5c5e7, ) = explode('=',$m6c0d0); if ($j5c5e7=='go'){ $wa37bf.='?'. $m6c0d0; $h5d6ba.='?'. urldecode($m6c0d0); } } $_current_url=$wa37bf; if ($wa37bf!=$k95d32 and $h5d6ba!=$k95d32){ e2_go_to($k95d32); } } if(is_callable($uc48ba)) { $r2cb9d=array ($uc48ba,$parameters); } else { $r2cb9d=array (null, array ()); } } else { $r2cb9d=array (null, array ()); } foreach($_GET as $b3c6e0 => $w2063c){ if ($b3c6e0!=='go')$r2cb9d[1][$b3c6e0]=$w2063c; } if(Log::$ned2b5){ if(count($r2cb9d[1]) > 0){ $xf8cea=print_r($r2cb9d[1],true); $xf8cea=substr($xf8cea,8, -2); $xf8cea='    '. trim($xf8cea); $xf8cea=preg_replace('/^.*?$/smu','         $0',$xf8cea); $xf8cea=' with parameters:'."\r\n". $xf8cea; } __log( 'Resolved to candy "'. $r2cb9d[0] .'"'. $xf8cea ); } return $r2cb9d; } function e2urls__expand_tricky_parameters_for_note_($w39a37){ global $ra57c1,$_config,$_e2_day_numbers_by_note_id; if (!isset ($w39a37['IsPublished'])) { return array (); } if (!$w39a37['IsPublished']) { if ($w39a37['OriginalAlias']===''){ $parameters['draft']=$w39a37['ID']; } elseif(e2_draft_alias_use_count($w39a37['OriginalAlias']) == 1){ $parameters['oalias']=$w39a37['OriginalAlias']; } else { $parameters['draft2']=$w39a37['ID']; $parameters['oalias2']=$w39a37['OriginalAlias']; } $parameters['is-published']=0; return$parameters; } $parameters['is-published']=1; $xb80bb=$w39a37['ID']; $k96b8c=$w39a37['Stamp']; $mb2c6c=l0923($w39a37); if (!isset ($w39a37['__noalias!'])) { if (isset ($w39a37['alias'])) { $parameters['alias']=$w39a37['alias']; } else { $parameters['alias']=e2_active_alias_for_page_(ENTITY_TYPE_NOTE,$w39a37['ID']); if($parameters['alias']=='') unset($parameters['alias']); } } if(array_key_exists('alias',$parameters)) return$parameters; list ($q41529,$t6f8f5,$r8277e)=explode('/', h5a2f('Y/m/d',$k96b8c,$mb2c6c) ); $parameters['year']=$q41529; $parameters['month']=$t6f8f5; $parameters['day']=$r8277e; if (isset ($w39a37['day_number'])) { $parameters['day-number']=$w39a37['day_number']; } elseif (isset ($_e2_day_numbers_by_note_id[$w39a37['ID']])) { $parameters['day-number']=$_e2_day_numbers_by_note_id[$w39a37['ID']]; } else { list ($yd9d0f, ) = z5273($q41529,$t6f8f5,$r8277e); u0738( "SELECT `ID`, `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished` = 1 AND (`Stamp` BETWEEN " .$yd9d0f. " AND " .$k96b8c. ") ". "ORDER BY `Stamp`", 'get all notes that could be on this date even in different timezones for legacy url resolution' ); $result=d0d6b(); $ib1bc2=1; foreach($result as $m65afd){ if ( $q41529.'/'.$t6f8f5.'/'.$r8277e == h5a2f('Y/m/d',$m65afd['Stamp'],l0923($m65afd)) ) { if ($m65afd['ID']==$xb80bb){ $g444bc=1; break; } $ib1bc2 ++; } } if (@$g444bc!=1){ header('HTTP/1.1 503 Service Unavailable'); die ('Candidates enumeration failed.'); } $parameters['day-number']=$ib1bc2; $_e2_day_numbers_by_note_id[$w39a37['ID']] = $ib1bc2; } return$parameters; } function e2urls__expand_tricky_parameters_for_tags_($c0dff3){ $z9299d=array(); $parameters=array(); foreach ($c0dff3 as $rb19ad){ $k72487=''; if (!isset ($rb19ad['__noalias!'])) { if (isset ($rb19ad['tag-alias'])) { $k72487=$rb19ad['tag-alias']; } else { $k72487=e2_active_alias_for_page_(ENTITY_TYPE_TAG,$rb19ad['ID']); } } $z9299d[] = $k72487? $k72487:$rb19ad['OriginalAlias']; } if(count($c0dff3)) { $parameters['tag-alias']=implode(',',$z9299d); } return$parameters; } function e2urls__consolidate_tricky_parameters_($parameters){ if ( (string) @$parameters['alias']!=='' or ( (string) @$parameters['year']!=='' and (string) @$parameters['month']!=='' and (string) @$parameters['day']!=='' and (string) @$parameters['day-number']!=='' ) ) { if ($saad65=e2_published_noterec_with_parameters_($parameters)) { $parameters['*note']=$saad65; } } if ( (string) @$parameters['oalias']!=='' or (string) @$parameters['draft']!=='' or (string) @$parameters['oalias2']!=='' or (string) @$parameters['draft2']!=='' ){ if ($saad65=e2_noterec_with_parameters_($parameters)) { $parameters['*note']=$saad65; } } if ( (string) @$parameters['tag-alias']!=='' ){ $parameters['*tags']=e2_tagrecs_with_parameters_($parameters); if(count($parameters['*tags']) == 1){ $parameters['*tag']=$parameters['*tags'][0]; } } return$parameters; } function p3aa5($i9dd4e){ global$_e2utf8__unformat_htmlentity_neasden; if($_e2utf8__unformat_htmlentity_neasden){ return $i9dd4e; } else { return '((html '. $i9dd4e .'))'; } } function medd9($re98a6,$j98df3=false){ $s80a41=''; $tf5a8e=strlen($re98a6); for ($f865c0=0; $f865c0 < 256; ++ $f865c0){ $sf3d13[$f865c0]=0; $r0fc3c=$f865c0; while ($r0fc3c & 0x00000080){ $r0fc3c <<= 1; ++ $sf3d13[$f865c0]; } } for ($f865c0=0xd090; $f865c0 <= 0xd0bf; $f865c0++)$y84a26[$f865c0]=chr(($f865c0 & 0x000000ff)+48); for ($f865c0=0xd180; $f865c0 <= 0xd18f; $f865c0++)$y84a26[$f865c0]=chr(($f865c0 & 0x000000ff)+112); $y84a26[0xd081]="\xa8"; $y84a26[0xd191]="\xb8"; $y84a26[0xc299]="\x99"; $y84a26[0xc2a9]="\xa9"; $y84a26[0xc2ae]="\xae"; $y84a26[0xc2ab]="\xab"; $y84a26[0xc2bb]="\xbb"; $y84a26[0xc2a0]="\xa0"; $f865c0=0; while ($f865c0 < $tf5a8e){ $zac558=$re98a6[$f865c0]; $hc267c=ord($zac558); if ($sf3d13[$hc267c]==0){ $s80a41.=$zac558; ++ $f865c0; } elseif ($sf3d13[$hc267c]==2){ $r06214=$y84a26[($hc267c << 8) | ord($re98a6[$f865c0+1])]; $s80a41 .= ($r06214!=null)? $r06214 : ( $j98df3? (p3aa5( cebe5(substr($re98a6,$f865c0,2)) )) : '?' ); $f865c0+=2; } else { $rdfbc9=substr($re98a6,$f865c0,$sf3d13[$hc267c]); if ($rdfbc9=="\xe2\x84\x96")$s80a41.="\xb9"; elseif ($rdfbc9=="\xe2\x80\x93")$s80a41.="\x96"; elseif ($rdfbc9=="\xe2\x80\x94")$s80a41.="\x97"; elseif ($rdfbc9=="\xe2\x80\x98")$s80a41.="\x91"; elseif ($rdfbc9=="\xe2\x80\x99")$s80a41.="\x92"; elseif ($rdfbc9=="\xe2\x80\x9a")$s80a41.="\x82"; elseif ($rdfbc9=="\xe2\x80\x9c")$s80a41.="\x93"; elseif ($rdfbc9=="\xe2\x80\x9d")$s80a41.="\x94"; elseif ($rdfbc9=="\xe2\x80\x9e")$s80a41.="\x84"; elseif ($rdfbc9=="\xe2\x80\xa6")$s80a41.="\x85"; elseif ($rdfbc9=="\xe2\x80\xb9")$s80a41.="\x8b"; elseif ($rdfbc9=="\xe2\x80\xba")$s80a41.="\x9b"; elseif ($rdfbc9=="\xe2\x82\xac")$s80a41.="\x88"; elseif ($rdfbc9=="\xe2\x84\xa2")$s80a41.="\x99"; else $s80a41.=$j98df3? (p3aa5( cebe5($rdfbc9) )) : '?'; $f865c0+=$sf3d13[$hc267c]; } } return $s80a41; } function cebe5($c4a8a0){ $icc411=''; $tf5a8e=strlen($c4a8a0); for ($f865c0=0; $f865c0 < $tf5a8e; ++ $f865c0){ $icc411.=preg_replace('/^1*0/','',decbin(ord($c4a8a0[$f865c0]))); } return '&#'. bindec($icc411) .';'; } function ffd97($w341be) { $r2cb9d=$w341be; $r2cb9d=preg_replace_callback('/([\x80-\xFF])/','e2_utf_from_windows_1251_char',$r2cb9d); return $r2cb9d; } function e2_utf_from_windows_1251_char($c4a8a0){ list (, $c4a8a0)=$c4a8a0; if ($c4a8a0=="\xa8") return "\xd0\x81"; if ($c4a8a0=="\xb8") return "\xd1\x91"; if ($c4a8a0 >= "\xc0" && $c4a8a0 <= "\xef") return "\xd0".chr(ord($c4a8a0)-48); if ($c4a8a0 >= "\xf0") return "\xd1".chr(ord($c4a8a0)-112); if ($c4a8a0=="\x85") return "\xe2\x80\xa6"; if ($c4a8a0=="\x96") return "\xe2\x80\x93"; if ($c4a8a0=="\x97") return "\xe2\x80\x94"; if ($c4a8a0=="\xab") return "\xc2\xab"; if ($c4a8a0=="\xbb") return "\xc2\xbb"; if ($c4a8a0=="\x91") return "\xe2\x80\x98"; if ($c4a8a0=="\x92") return "\xe2\x80\x99"; if ($c4a8a0=="\x93") return "\xe2\x80\x9c"; if ($c4a8a0=="\x94") return "\xe2\x80\x9d"; if ($c4a8a0=="\x84") return "\xe2\x80\x9e"; if ($c4a8a0=="\x99") return "\xe2\x84\xa2"; if ($c4a8a0=="\xb9") return "\xe2\x84\x96"; if ($c4a8a0=="\xa0") return "\xc2\xa0"; return '?'; }; function e2_utf8_version_of_array_($cf1f71){ foreach ($cf1f71 as $d8ce4b => $t9e366){ if (!array_key_exists($d8ce4b.'.u?',$cf1f71)) { if(is_string($cf1f71[$d8ce4b])) { $cf1f71[$d8ce4b]=ffd97($cf1f71[$d8ce4b]); } elseif(is_array($cf1f71[$d8ce4b])) { $cf1f71[$d8ce4b]=e2_utf8_version_of_array_($cf1f71[$d8ce4b]); } } } return $cf1f71; } function n869e($t6f8f5){ return mb_convert_encoding($t6f8f5[0],'HTML-ENTITIES','UTF-8'); } function uff7c($w341be,$m22019=false){ if ($m22019){ return preg_replace_callback( '/[\x{10000}-\x{fffff}]/u','e2_question_long_utf8_chars_helper',$w341be ); } else { return preg_replace('/[\x{10000}-\x{fffff}]/u','?',$w341be); } } function e2img_filename_by_processing( $mfce75,$e1c925, $a26635,$xcff96,$ud6663 ){ global$_config; if(Log::$ned2b5)__log('Process image: "'. $mfce75 .'" -> "'. $e1c925 .'"'); if (!is_file($mfce75)) return false; $c9c26d=stat($mfce75)['size']; if (!hb6c5($mfce75)) { if(Log::$ned2b5)__log('Process image: SVG, no processing'); return $mfce75; } if(is_file($e1c925) and !w4f9d($mfce75,$e1c925)) { if(Log::$ned2b5)__log('Process image: Already exists'); return $e1c925; } if (!extension_loaded('gd')) return false; $n7ae08=pathinfo($e1c925); if (!@eaf42($n7ae08['dirname'])) { if(Log::$ned2b5)__log( 'Process image: Cant create directory <'. $n7ae08['dirname'] .'>' ); return false; } if(Log::$ned2b5)__log('Process image: Detecting image type'); $type=e2img__type_of_file($mfce75); if (!$type) return false; $m94ba2='imagecreatefrom'. $type; if (!function_exists($m94ba2)) return false; if(Log::$ned2b5)__log('Process image: Opening original image ('. $m94ba2 .')'); $b1ccee=call_user_func($m94ba2,$mfce75); if (!$b1ccee) return false; if ($m89918=e2img__orientation_of_file($mfce75)) { if(Log::$ned2b5)__log('Process image: Needs orientation fix'); $b1ccee=e2img__res_rotate($b1ccee, -$m89918); } $d6af77=[imagesx($b1ccee),imagesy($b1ccee)]; $sb3e38=$d6af77; $hac50f=[0,0,0,0]; if ($xcff96==CROP_SQUARE){ if(Log::$ned2b5)__log('Process image: Needs crop'); list ($sb3e38,$hac50f) = ( e2img__crop_metrics_to_square($sb3e38) ); } $sb3e38=e2_fit_metrics_to_constraints( $sb3e38,$a26635 ); if ( $m89918===0 and $sb3e38===$d6af77 ){ if(Log::$ned2b5)__log('Process image: No changes necessary, leaving original'); return $mfce75; } if(Log::$ned2b5)__log(var_export($sb3e38,true)); if(Log::$ned2b5)__log(var_export($hac50f,true)); $o26ea7=e2img__create_copy_resampled( $b1ccee, $sb3e38, $hac50f, $type ); imagejpeg($o26ea7,$e1c925,$ud6663); if (!is_file($e1c925)) { if(Log::$ned2b5)__log('Process image: File not created by imagejpeg'); return false; } if ($m89918===0){ $o46c12=stat($e1c925)['size']; if ($o46c12 >= $c9c26d){ if(Log::$ned2b5)__log('Process image: Conversion to JPEG made file bigger, back up'); unlink($e1c925); $e1c925=$mfce75; } } @chmod($e1c925,$_config['uploaded_files_mode']); if(Log::$ned2b5)__log('Process image: Done'); return $e1c925; } function e2img__create_copy_resampled( $b1ccee,$sb3e38,$hac50f,$type ){ list ($rd4d55,$q455ce)=$sb3e38; list ($p98453,$v2aaef,$db40c7,$l0a71b)=$hac50f; $o26ea7=imagecreatetruecolor($rd4d55,$q455ce); if($type==='png'){ imagefill($o26ea7,0,0,imagecolorallocate($o26ea7,255,255,255)); imagealphablending($o26ea7,true); } $x2097d=imagesx($b1ccee); $i97874=imagesy($b1ccee); imagecopyresampled( $o26ea7, $b1ccee, 0,0, 0+$p98453,0+$v2aaef, $rd4d55,$q455ce, $x2097d-$db40c7,$i97874-$l0a71b ); imageinterlace($o26ea7,1); return $o26ea7; } function e2img__type_of_file($j435ed){ $scaf9b=@getimagesize($j435ed); if (!$scaf9b or $scaf9b[2] > 3) return false; if ($scaf9b[2]==IMAGETYPE_GIF) return 'gif'; if ($scaf9b[2]==IMAGETYPE_JPEG) return 'jpeg'; if ($scaf9b[2]==IMAGETYPE_PNG) return 'png'; return false; } function e2img__orientation_of_file($j435ed){ if (!function_exists('exif_read_data')) return 0; if (($a9beff=@exif_read_data($j435ed)) === false) return 0; if ($a9beff['Orientation']==3) return -180; if ($a9beff['Orientation']==6) return -270; if ($a9beff['Orientation']==8) return -90; return 0; } function e2img__res_rotate($s9b207,$m89918){ $a65370=imagerotate($s9b207,$m89918,0); if ($a65370!==false){ imagedestroy($s9b207); $s9b207=$a65370; } return $s9b207; } function e2_fit_metrics_to_constraints( $u0b73d,$a26635 ){ if ($a26635===false)$a26635=[0,0]; list ($veaae2,$fb435e)=$u0b73d; list ($wdb99b,$f4278c)=$a26635; $m8e7bb=[1]; if ($wdb99b)$m8e7bb[] = $wdb99b/$veaae2; if ($f4278c)$m8e7bb[] = $f4278c/$fb435e; $o0cb47=min($m8e7bb); if ($o0cb47 < 1){ $veaae2=(int)round($veaae2*$o0cb47); $fb435e=(int)round($fb435e*$o0cb47); } return [$veaae2,$fb435e]; } function e2img__crop_metrics_to_square($u0b73d){ $v81188=$cb2835=$q4505c=$me6dec=0; list ($veaae2,$fb435e)=$u0b73d; if ($veaae2 > $fb435e){ $q4505c=$veaae2-$fb435e; $v81188=floor($q4505c/2); $fb435e=$veaae2; } elseif ($veaae2 < $fb435e){ $me6dec=$fb435e-$veaae2; $cb2835=floor($q4505c/2); $veaae2=$fb435e; } $hac50f=[$v81188,$cb2835,$q4505c,$me6dec]; $q27e5c=[$veaae2,$fb435e]; return [$q27e5c,$hac50f]; } $_folders_written=array ( '.', USER_FOLDER, CACHES_FOLDER, BACKUP_FOLDER, LOG_FOLDER, MEDIA_ROOT_FOLDER.PICTURES_FOLDER, MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER, MEDIA_ROOT_FOLDER.PICTURES_FOLDER .'remote/', MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER .'remote/', MEDIA_ROOT_FOLDER.AUDIO_FOLDER, MEDIA_ROOT_FOLDER.AVATARS_FOLDER, ); $_files_written=array ( USER_FOLDER.'password-hash.psa', USER_FOLDER.'password-wait.psa', USER_FOLDER.'last-comment.psa', USER_FOLDER.'new-uploads.psa', USER_FOLDER.'settings.json', USER_FOLDER.'indexing.psa', USER_FOLDER.'auth.psa', USER_FOLDER.'scheduled.psa', ); define('CROP_NONE',0); define('CROP_SQUARE',1); define('PROVIDE_DATA_SPAWN',10); define('PROVIDE_DATA_NOW',20); function jea70(){ global$_folders_written,$_files_written; clearstatcache(); $d10ae9=array(); foreach($_folders_written as $x8fa14){ if(is_dir($x8fa14) and !is_writable($x8fa14)) { $d10ae9[] = $x8fa14; } } foreach($_files_written as $x8fa14){ if(is_file($x8fa14) and !is_writable($x8fa14)) { $d10ae9[] = $x8fa14; } } return $d10ae9; } function k6e52($d8c7dd,$fb45cf){ @eaf42(dirname($d8c7dd)); if (!@file_put_contents($d8c7dd,$fb45cf,LOCK_EX)) { return false; } @chmod($d8c7dd,E2_NEW_FILES_RIGHTS); return true; } function m1cae($o954eb){ if(preg_match('/^https?\:\/\//iu',$o954eb)) { $s6efa1=$o954eb; $s6efa1=preg_replace('/^https?\:\/\//iu','',$s6efa1); $s6efa1=str_replace('/','--',$s6efa1); $s6efa1=MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER.$s6efa1; } else { $s6efa1=MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER.$o954eb; } $s6efa1=e2files__add_ext_prefix($s6efa1,'thumb@2x'); return $s6efa1; } function c6e61($o954eb){ if(preg_match('/^https?\:\/\//iu',$o954eb)) { $jaf721=$o954eb; } else { $jaf721=MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$o954eb; } $s6efa1=e2img_filename_by_processing( $jaf721, m1cae($o954eb), [THUMB_WIDTH,THUMB_HEIGHT], CROP_NONE, THUMB_JPG_QUALITY ); if ($s6efa1===false) return false; $tf5a8e=strlen(MEDIA_ROOT_FOLDER); if(substr($s6efa1,0,$tf5a8e)==MEDIA_ROOT_FOLDER){ $e85133=substr($s6efa1,$tf5a8e); } return $e85133; } function c30f2($jaf721){ $c8743c=pathinfo($jaf721); $iabf77=$c8743c['extension']; return (in_array(strtolower($iabf77), array ('jpg','jpeg','gif','png','svg'))); } function hb6c5($jaf721){ $c8743c=pathinfo($jaf721); $iabf77=$c8743c['extension']; return (in_array(strtolower($iabf77), array ('jpg','jpeg','gif','png'))); } function gef67($jaf721){ $c8743c=pathinfo($jaf721); $iabf77=$c8743c['extension']; if ($iabf77=='png') return IMAGETYPE_PNG; if ($iabf77=='gif') return IMAGETYPE_GIF; if ($iabf77=='jpg' or $iabf77=='jpeg') return IMAGETYPE_JPEG; } function oc952($jaf721){ $c8743c=pathinfo($jaf721); $iabf77=$c8743c['extension']; if ($iabf77=='png') return 'image/png'; if ($iabf77=='gif') return 'image/gif'; if ($iabf77=='jpg' or $iabf77=='jpeg') return 'image/jpeg'; if ($iabf77=='mp3') return 'audio/mpeg'; } function d19a4($j435ed){ if (hb6c5($j435ed)) { list ($veaae2,$fb435e)=getimagesize($j435ed); } else { $ge2da9=simplexml_load_string(file_get_contents($j435ed)); if ($ge2da9){ $hd0a5e=$ge2da9->attributes(); list ($veaae2,$fb435e) = array ((string)$hd0a5e -> width, (string)$hd0a5e -> height); } else { return false; } } if(substr($j435ed,strrpos($j435ed,'.')-3,3)=='@2x'){ $veaae2=(int)floor($veaae2/2); $fb435e=(int)floor($fb435e/2); } return array ($veaae2,$fb435e); } function e2s_retrieve($parameters){ $h36cd3=urldecode(base64_decode($parameters['url'])); if(Log::$ned2b5)__log('Retrieve: '. $h36cd3); c1066($h36cd3,PROVIDE_DATA_NOW); } function pd222($r447b7){ global$full_blog_url; $w78f08=parse_url($r447b7); if (isset ($w78f08['host'])) { if ($w78f08['host']=='www.youtube.com'){ $xb80bb=basename($w78f08['path']); $s15ba8='remote/youtube-'. $xb80bb .'-cover.jpg'; return array ( 'type' => 'online-video', 'is-local?' => false, 'is-rss-enclosure?' => false, 'video-service' => 'youtube', 'video-id' => $xb80bb, 'local-cover-name' => $s15ba8, 'local-cover-href' => $full_blog_url .'/'. PICTURES_FOLDER.$s15ba8, 'local-full-filename' => MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$s15ba8, 'local-full-failname' => MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$s15ba8.'.failed', ); } elseif ($w78f08['host']=='player.vimeo.com'){ $xb80bb=basename($w78f08['path']); $s15ba8='remote/vimeo-'. $xb80bb .'-cover.jpg'; return array ( 'type' => 'online-video', 'is-local?' => false, 'is-rss-enclosure?' => false, 'video-service' => 'vimeo', 'video-id' => $xb80bb, 'local-cover-name' => $s15ba8, 'local-cover-href' => $full_blog_url .'/'. PICTURES_FOLDER.$s15ba8, 'local-full-filename' => MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$s15ba8, 'local-full-failname' => MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$s15ba8.'.failed', ); } elseif (c30f2($w78f08['path'])) { return array ( 'type' => 'remote-image', 'is-local?' => false, 'is-rss-enclosure?' => false, 'url' => $r447b7, 'mime-type' => oc952($w78f08['path']), 'length' => '', ); } else { return array ( 'type' => 'remote-non-image', 'is-local?' => false, 'is-rss-enclosure?' => true, 'url' => $r447b7, 'mime-type' => oc952($w78f08['path']), 'length' => '', ); } } else { if (c30f2($w78f08['path'])) { $sb6d7a=MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$w78f08['path']; return array ( 'type' => 'local-image', 'is-local?' => true, 'is-rss-enclosure?' => false, 'url' => $full_blog_url .'/'. PICTURES_FOLDER.$w78f08['path'], 'mime-type' => oc952($w78f08['path']), 'length' => @stat($sb6d7a)['size'], 'local-href' => $full_blog_url .'/'. PICTURES_FOLDER.$w78f08['path'], 'local-full-filename' => $sb6d7a, ); } else { $sb6d7a=MEDIA_ROOT_FOLDER.AUDIO_FOLDER.$w78f08['path']; return array ( 'type' => 'local-non-image', 'is-local?' => true, 'is-rss-enclosure?' => true, 'url' => $full_blog_url .'/'. AUDIO_FOLDER.$w78f08['path'], 'mime-type' => oc952($w78f08['path']), 'length' => @stat($sb6d7a)['size'], 'local-href' => $full_blog_url .'/'. AUDIO_FOLDER.$w78f08['path'], 'local-full-filename' => $sb6d7a, ); } } } function c1066($r447b7,$ydb88a){ $t1c149=pd222($r447b7); if ($t1c149['type']=='remote-image'){ } elseif ($t1c149['type']=='online-video'){ if(is_file($t1c149['local-full-filename'])) { if(Log::$ned2b5)__log('Already exists: '. $t1c149['local-full-filename']); } elseif(is_file($t1c149['local-full-failname'])) { if(Log::$ned2b5)__log('Already tried and failed: '. $t1c149['local-full-filename']); } else { if(Log::$ned2b5)__log($r447b7.' is missing a cover, retrieving'); if ($ydb88a==PROVIDE_DATA_SPAWN){ gcc38(x83c8('e2s_retrieve', array ( 'url' => urlencode(base64_encode($r447b7)), ))); } if ($ydb88a==PROVIDE_DATA_NOW){ if ($t1c149['video-service']=='youtube') { $v5f89d=array ( 'maxresdefault','hqdefault','mqdefault','sddefault','default' ); foreach ($v5f89d as $zd7d16){ $t572d4='http://img.youtube.com/vi/'. $t1c149['video-id'] .'/'. $zd7d16 .'.jpg'; if(Log::$ned2b5)__log('Getting '.$t572d4 .' as '. $t1c149['local-full-filename']); $l6c43d=file_get_contents($t572d4); if ($l6c43d!==false) break; } } if ($t1c149['video-service']=='vimeo') { $oc4a72=unserialize( file_get_contents('http://vimeo.com/api/v2/video/'. $t1c149['video-id'] .'.php') ); if (isset ($oc4a72[0]['thumbnail_large'])) { $l6c43d=file_get_contents($oc4a72[0]['thumbnail_large']); } } if ($l6c43d!==false){ k6e52($t1c149['local-full-filename'],$l6c43d); } else { k6e52($t1c149['local-full-failname'],''); } } } if ($ydb88a==PROVIDE_DATA_NOW){ if(is_file($t1c149['local-full-filename'])) { c6e61($t1c149['local-cover-name']); } } } elseif ($t1c149['type']=='local-image'){ if(Log::$ned2b5)__log($r447b7.' is a local image'); c6e61($r447b7); } elseif ($t1c149['type']=='local-non-image'){ if(Log::$ned2b5)__log($r447b7.' is a local non-image'); } } function t6be4($d10ae9){ if (!is_array($d10ae9)) return; if(Log::$ned2b5)__log('Provide data for resources {'); foreach ($d10ae9 as $r447b7){ c1066($r447b7,PROVIDE_DATA_SPAWN); } if(Log::$ned2b5)__log('}'); } function hf898($l89111,$rdffc4,$se449c){ $c5128f=p1722($l89111,$rdffc4); $y55b55=array_merge($c5128f,$se449c); $y55b55=array_reverse($y55b55); $y55b55=array_unique($y55b55); $y55b55=array_reverse($y55b55); return b2e82($y55b55,RESOURCES_LOCAL); } function afc4d($yd430b,$o2bfe4){ $n84841=array(); if(is_array($o2bfe4['meta']['resources-detected'])) { $se449c=$o2bfe4['meta']['resources-detected']; $n84841=wdc5a($se449c); } $e16137=@unserialize( $yd430b['Uploads'] ) or $e16137=array(); $t08204=array_diff($n84841,$e16137); if(count($t08204) > 0){ l2cf0('note',$yd430b['ID'],'add',$t08204); } return $t08204; } function wdc5a($yd7f81){ $d10ae9=array(); foreach ($yd7f81 as $f1993e){ $t1c149=pd222($f1993e); if ($t1c149['is-local?'])$d10ae9[] = $f1993e; } return $d10ae9; } function b2e82($y55b55,$v8b7af=RESOURCES_ALL){ global$full_blog_url,$_strings; $fef067=array(); $v59b51=array(); if (!is_array($y55b55)) return $v59b51; t6be4($y55b55); foreach ($y55b55 as $o96ab4){ $t1c149=pd222($o96ab4); $f11b42=''; if ($t1c149['is-local?'] and is_file($t1c149['local-full-filename'])) { $f11b42=stat($t1c149['local-full-filename'])[7]; $f11b42=round($f11b42/1024) .' '. $_strings['gs--kb']; } if ($v8b7af==RESOURCES_LOCAL and !$t1c149['is-local?']) continue; if ($t1c149['type']=='remote-image'){ } elseif ($t1c149['type']=='remote-non-image'){ } elseif ($t1c149['type']=='online-video'){ if ($q742c4=c6e61($t1c149['local-cover-name'])) { $size=d19a4(MEDIA_ROOT_FOLDER.$q742c4); list ($veaae2,$fb435e)=$size; if (!in_array($o96ab4,$fef067)) { $fef067[] = $o96ab4; $v59b51[] = array ( 'original-filename' => $o96ab4, 'href' => $full_blog_url .'/'. $q742c4, 'width' => $veaae2, 'height' => $fb435e, ); } } } elseif ($t1c149['type']=='local-image'){ if ($q742c4=c6e61($o96ab4)) { $size=d19a4(MEDIA_ROOT_FOLDER.$q742c4); list ($veaae2,$fb435e)=$size; if (!$veaae2)$veaae2=THUMB_WIDTH/2; if (!$fb435e)$fb435e=THUMB_HEIGHT/2; list ($veaae2,$fb435e)=e2_fit_metrics_to_constraints( [$veaae2,$fb435e], [THUMB_WIDTH/2,THUMB_HEIGHT/2] ); if (!in_array($o96ab4,$fef067)) { $fef067[] = $o96ab4; $v59b51[] = array ( 'original-filename' => $o96ab4, 'original-filesize' => $f11b42, 'href' => $full_blog_url .'/'. $q742c4, 'width' => $veaae2, 'height' => $fb435e, ); } } else { if (!in_array($o96ab4,$fef067)) { $fef067[] = $o96ab4; $v59b51[] = array ( 'original-filename' => $o96ab4, 'original-filesize' => '', 'href' => $full_blog_url .'/'. m1cae($o96ab4), 'width' => 0, 'height' => 0, ); } } } elseif ($t1c149['type']=='local-non-image'){ if(is_file(MEDIA_ROOT_FOLDER.AUDIO_FOLDER.$o96ab4)) { if (!in_array($o96ab4,$fef067)) { $fef067[] = $o96ab4; $v59b51[] = array ( 'original-filename' => $o96ab4, 'original-filesize' => $f11b42, 'href' => $full_blog_url .'/'. AUDIO_ICON_IMAGE, 'width' => AUDIO_ICON_WIDTH, 'height' => AUDIO_ICON_HEIGHT, ); } } else { if (!in_array($o96ab4,$fef067)) { $fef067[] = $o96ab4; $v59b51[] = array ( 'original-filename' => $o96ab4, 'original-filesize' => '', 'href' => $full_blog_url .'/'. AUDIO_ICON_IMAGE, 'width' => 0, 'height' => 0, ); } } } } return $v59b51; } function tdbcc($l89111,$rdffc4,$y55b55){ global$full_blog_url; $d10ae9=array(); if(is_array($y55b55)) { $d10ae9=e2files__list_og_images_for_resources_($y55b55); } $c5128f=p1722($l89111,$rdffc4); if(is_array($c5128f)) { foreach ($c5128f as $d8ce4b => $t9e366){ if(is_file(MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$t9e366)) { $c5128f[$d8ce4b]=$full_blog_url .'/'. PICTURES_FOLDER.$t9e366; } else { unset ($c5128f[$d8ce4b]); } } $d10ae9=array_merge($c5128f,$d10ae9); } $d10ae9=array_reverse($d10ae9); $d10ae9=array_unique($d10ae9); $d10ae9=array_reverse($d10ae9); return $d10ae9; } function e2files__list_og_images_for_resources_($y55b55){ $v59b51=array(); t6be4($y55b55); foreach ($y55b55 as $o96ab4){ $t1c149=pd222($o96ab4); if ($t1c149['type']=='remote-image'){ } elseif ($t1c149['type']=='remote-non-image'){ } elseif ($t1c149['type']=='online-video'){ if(is_file($t1c149['local-full-filename'])) { $v59b51[] = $t1c149['local-cover-href']; } } elseif ($t1c149['type']=='local-image'){ if(is_file($t1c149['local-full-filename'])) { $v59b51[] = $t1c149['local-href']; } } elseif ($t1c149['type']=='local-non-image'){ } } return $v59b51; } function a9c0a($vb0689,$l12e09){ $vb0689=l2183($vb0689); if(preg_match('//u',$vb0689))$vb0689=medd9($vb0689,false); if ($l12e09=='image'){ $y85114=MEDIA_ROOT_FOLDER.PICTURES_FOLDER; } elseif ($l12e09=='audio'){ $y85114=MEDIA_ROOT_FOLDER.AUDIO_FOLDER; } else { return false; } $f96704=''; for ($f865c0=0; $f865c0 < strlen($vb0689); $f865c0++) { if ($vb0689[$f865c0]=='?'){ $f96704.=''; } elseif ($vb0689[$f865c0]==' '){ $f96704.='-'; } elseif(ord($vb0689[$f865c0]) <= 127){ $f96704.=$vb0689[$f865c0]; } } if ($f96704=='')$f96704=$l12e09; if ($f96704[0]=='.')$f96704=$l12e09.$f96704; return $f96704; } function mf0fb($z76ee3){ global$_config; if(Log::$ned2b5)__log('Count references for upload <'. $z76ee3 .'>'); if(is_file(USER_FOLDER.'new-uploads.psa')) { $e7cd94=@unserialize(file_get_contents(USER_FOLDER.'new-uploads.psa')); } $c5a976='%'. str_replace('%','#%',$z76ee3) .'%'; u0738( "SELECT `ID`, `Text`, `FormatterID`, `Uploads` ". "FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (`Text` LIKE '". $c5a976 ."' ESCAPE '#' ". "OR `Uploads` LIKE '". $c5a976 ."' ESCAPE '#')", 'get notes where uploads may be referenced' ); $result=d0d6b(); $jbe270=@unserialize($result[0]['Uploads']); if (!is_array($jbe270)) { foreach($result as $w39a37){ $o2bfe4=j154e( $w39a37['FormatterID'], @$w39a37['Text'],'full-rss' ); $jbe270=afc4d($w39a37,$o2bfe4); } } u0738( "SELECT `ID`, `Description`, `Uploads` ". "FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (`Description` LIKE '". $c5a976 ."' ESCAPE '#' ". "OR `Uploads` LIKE '". $c5a976 ."' ESCAPE '#')", 'get tags where uploads may be referenced' ); $result=d0d6b(); $k6ae44=@unserialize($result[0]['Uploads']); if (!is_array($k6ae44)) { foreach($result as $rb19ad){ $o2bfe4=bb7f1( @$rb19ad['Description'],'full-rss' ); $k6ae44=afc4d($rb19ad,$o2bfe4); } } if (!is_array($e7cd94))$e7cd94=[]; if (!is_array($jbe270))$jbe270=[]; if (!is_array($k6ae44))$k6ae44=[]; $c5128f=array_merge($e7cd94,$jbe270,$k6ae44); if(Log::$ned2b5)__log('References found in relevant entries: '. var_export($c5128f,true)); if(in_array($z76ee3,$c5128f)) { if(Log::$ned2b5)__log('Still referenced, do not delete file'); return true; } return false; } function p1722($tf5e63,$xb80bb){ global$_config; if ($tf5e63=='note' and $xb80bb=='new'){ if(is_file(USER_FOLDER.'new-uploads.psa')) { $c5128f=@unserialize(file_get_contents(USER_FOLDER.'new-uploads.psa')); } } elseif ($tf5e63=='note'){ u0738( "SELECT `Uploads` FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $xb80bb ); $result=d0d6b(); $c5128f=@unserialize($result[0]['Uploads']); } elseif ($tf5e63=='tag'){ u0738( "SELECT `Uploads` FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $xb80bb ); $result=d0d6b(); $c5128f=@unserialize($result[0]['Uploads']); } if (!is_array($c5128f))$c5128f=array(); return $c5128f; } function ucbba($tf5e63,$xb80bb,$c5128f){ global$_config; if ($tf5e63=='note' and $xb80bb=='new'){ if (!@k6e52(USER_FOLDER.'new-uploads.psa',serialize($c5128f))) { q8a40('ERROR',E2E_PERMISSIONS_ERROR); } } elseif ($tf5e63=='note'){ u0738( "UPDATE `". $_config['db_table_prefix']."Notes` ". "SET `Uploads`='". serialize($c5128f) ."' ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $xb80bb ); } elseif ($tf5e63=='tag'){ u0738( "UPDATE `". $_config['db_table_prefix']."Keywords` ". "SET `Uploads`='". serialize($c5128f) ."' ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $xb80bb ); } else { return false; } if (!is_array($c5128f))$c5128f=array(); return $c5128f; } function l2cf0($tf5e63,$xb80bb,$action,$u4a202){ global$_config; $c5128f=array(); if(Log::$ned2b5)__log('Register upload: <'. $tf5e63.', '. $xb80bb.', '. $action.', '. $u4a202 .'>'); $c5128f=p1722($tf5e63,$xb80bb); $c5128f=te1e7($c5128f,$action,$u4a202); ucbba($tf5e63,$xb80bb,$c5128f); } function t2f83($f4b27b,$sde17f,$se449c){ $e16137=@unserialize($sde17f['Uploads']) or $e16137=array(); $d28a47=wdc5a($se449c); $c5128f=te1e7($e16137,'add',$d28a47); $c5128f=serialize($c5128f); if ($c5128f!=$sde17f['Uploads']) { $sde17f['Uploads']=$c5128f; qaa79($f4b27b,$sde17f); } } function e2j_file_upload($parameters=array ()) { global$_config,$full_blog_url,$_strings; @eaf42(MEDIA_ROOT_FOLDER.PICTURES_FOLDER); @chmod(MEDIA_ROOT_FOLDER.PICTURES_FOLDER,$_config['uploaded_files_mode']); @eaf42(MEDIA_ROOT_FOLDER.AUDIO_FOLDER); @chmod(MEDIA_ROOT_FOLDER.AUDIO_FOLDER,$_config['uploaded_files_mode']); $gd1fc8=[ 'success' => false ]; if(count($_FILES) > 0){ foreach($_FILES as $d8c7dd){ if (!$d8c7dd['error']) { if(Log::$ned2b5)__log('Ajax file upload: <'. $d8c7dd['name'].'>'); $gd1fc8['data']['file-kind']='image'; $y85114=MEDIA_ROOT_FOLDER.PICTURES_FOLDER; if(substr($d8c7dd['name'],strrpos($d8c7dd['name'],'.')) == '.mp3'){ $gd1fc8['data']['file-kind']='audio'; $y85114=MEDIA_ROOT_FOLDER.AUDIO_FOLDER; } $u77dce=( array_key_exists('overwrite',$_GET) and is_file($y85114.$d8c7dd['name']) ); $s6f4b5=false; $gd1fc8['data']['overwrite'] = (int)$u77dce; if(Log::$ned2b5)__log('Ajax file upload: Overwrite is resolved to <'. (int)$u77dce.'>'); $f96704=a9c0a($d8c7dd['name'],$gd1fc8['data']['file-kind']); if(Log::$ned2b5)__log('Ajax file upload: Safe name is <'. $f96704.'>'); if(is_file($y85114.$f96704)) { if(file_get_contents($y85114.$f96704)==file_get_contents($d8c7dd['tmp_name'])) { if(Log::$ned2b5)__log('Ajax file upload: Existing file is the same'); $s6f4b5=true; } elseif (!$u77dce){ $f96704=e2files__find_free_filename($y85114,$f96704); } } if (!$s6f4b5){ move_uploaded_file($d8c7dd['tmp_name'],$y85114.$f96704); @chmod($y85114.$f96704,$_config['uploaded_files_mode']); } if(Log::$ned2b5)__log('Ajax file upload: File kind is <'. $gd1fc8['data']['file-kind'].'>'); if ($gd1fc8['data']['file-kind']=='image'){ $na28be=e2files__find_free_filename_with_added_ext( MEDIA_ROOT_FOLDER.PICTURES_FOLDER, $f96704,'jpg' ); $nb1cee=MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$f96704; $h093b5=MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$na28be; if(Log::$ned2b5)__log('Ajax file upload: Process uploaded image <'. $nb1cee.'>'. ' to possibly <'. $h093b5.'>'); $h093b5=e2img_filename_by_processing( $nb1cee, $h093b5, [ $_config['fit_uploaded_images'], $_config['fit_uploaded_images'], ], CROP_NONE, SCALED_IMAGE_JPG_QUALITY ); $f11b42=$d8c7dd['size']; if (!w4f9d($h093b5,$nb1cee)) { @unlink($nb1cee); $f96704=$na28be; $f11b42=stat($h093b5)['size']; } if ($u77dce){ @unlink(m1cae($f96704)); } if ($q742c4=c6e61($f96704)) { if(Log::$ned2b5)__log('Ajax file upload: thumbnail, done'); list ($veaae2,$fb435e)=d19a4(MEDIA_ROOT_FOLDER.$q742c4); if (!$veaae2)$veaae2=THUMB_WIDTH/2; if (!$fb435e)$fb435e=THUMB_HEIGHT/2; list ($veaae2,$fb435e)=e2_fit_metrics_to_constraints( [$veaae2,$fb435e], [THUMB_WIDTH/2,THUMB_HEIGHT/2] ); $gd1fc8['success']=true; $gd1fc8['data']['new-name']=$f96704; $gd1fc8['data']['filesize']=round($f11b42/1024) .' '. $_strings['gs--kb']; $gd1fc8['data']['thumb']=$full_blog_url .'/'. $q742c4; $gd1fc8['data']['width']=$veaae2; $gd1fc8['data']['height']=$fb435e; l2cf0($parameters['entity'],$parameters['entity-id'],'add', array ($f96704)); } else { if(Log::$ned2b5)__log('Ajax file upload: couldnt create thumbnail'); @unlink($y85114.$f96704); $gd1fc8['error']['message']=_S('er--cannot-create-thumbnail'); } } if ($gd1fc8['data']['file-kind']=='audio'){ if(Log::$ned2b5)__log('Ajax file upload: audio, done'); $gd1fc8['success']=true; $gd1fc8['data']['new-name']=$f96704; $gd1fc8['data']['filesize']=round($d8c7dd['size']/1024) .' '. $_strings['gs--kb']; $gd1fc8['data']['thumb']=AUDIO_ICON_IMAGE; $gd1fc8['data']['width']=AUDIO_ICON_WIDTH; $gd1fc8['data']['height']=AUDIO_ICON_HEIGHT; l2cf0($parameters['entity'],$parameters['entity-id'],'add', array ($f96704)); } } elseif(4!=$d8c7dd['error']) { if ($d8c7dd['error']==1){ $gd1fc8['error']['message']='too-big'; } elseif ($d8c7dd['error']==2){ $gd1fc8['error']['message']='too-big'; } elseif ($d8c7dd['error']==3){ $gd1fc8['error']['message']='partial'; } else { $gd1fc8['error']=$d8c7dd['error']; } } } } else { if(Log::$ned2b5)__log('Ajax file upload error: no files'); $gd1fc8['error']['message']='no-files'; } $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } function g8bd1(){ @unlink(USER_FOLDER.'[email protected]'); @unlink(USER_FOLDER.'[email protected]'); @unlink(USER_FOLDER.'[email protected]'); @unlink(USER_FOLDER.'[email protected]'); } function e2j_userpic_remove(){ if($_SERVER['REQUEST_METHOD']!='POST') return e2_go_to(x83c8('e2m_settings')); g8bd1(); $gd1fc8=json_encode([ 'success' => true ]); die ($gd1fc8); } function e2j_userpic_upload(){ global$_config; $gd1fc8=[ 'success' => false ]; if(count($_FILES)!=1){ if(Log::$ned2b5)__log('Ajax userpic upload error: no or too many files'); $gd1fc8['error']['message']='No or too many files'; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } $d8c7dd=array_pop($_FILES); if (!$d8c7dd['error']) { if(Log::$ned2b5)__log('Ajax userpic upload: <'. $d8c7dd['name'].'>'); $za93b8=pathinfo($d8c7dd['name']); $iabf77=strtolower($za93b8['extension']); if ($iabf77!='png')$iabf77='jpg'; $j435ed='userpic.original.'. $iabf77; move_uploaded_file($d8c7dd['tmp_name'],USER_FOLDER.$j435ed); @chmod(USER_FOLDER.$j435ed,$_config['uploaded_files_mode']); g8bd1(); copy( USER_FOLDER.$j435ed, USER_FOLDER .'[email protected]' ); $a48295=e2img_filename_by_processing( USER_FOLDER .'[email protected]', USER_FOLDER .'[email protected]', [$_config['max_image_width'],$_config['max_image_width']], CROP_NONE, USERPIC_JPG_QUALITY ); copy( USER_FOLDER.$j435ed, USER_FOLDER .'[email protected]' ); $y7d332=e2img_filename_by_processing( USER_FOLDER .'[email protected]', USER_FOLDER .'[email protected]', [$_config['max_image_width'],$_config['max_image_width']], CROP_SQUARE, USERPIC_JPG_QUALITY ); $tf1210=e2img_filename_by_processing( USER_FOLDER.$j435ed, USER_FOLDER .'[email protected]', [USERPIC_WIDTH,USERPIC_HEIGHT], CROP_SQUARE, USERPIC_JPG_QUALITY ); if ($y7d332){ $gd1fc8=[ 'success' => true, 'data' => [ 'new-image-src' => $y7d332, ] ]; } else { $gd1fc8['error']['message']=_S('er--unsupported-file-image'); } } elseif(4!=$d8c7dd['error']) { if ($d8c7dd['error']==1){ $gd1fc8['error']['message']='File too big'; } elseif ($d8c7dd['error']==2){ $gd1fc8['error']['message']='File too big'; } elseif ($d8c7dd['error']==3){ $gd1fc8['error']['message']='File upload is partial'; } else { $gd1fc8['error']['message']='File upload error '. $d8c7dd['error']; } } $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } function e2j_file_remove($parameters){ if (!array_key_exists('file',$_POST)) { $gd1fc8=[ 'success' => false ]; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } $d8c7dd=$_POST['file']; $gd1fc8=[ 'success' => true ]; $gd1fc8=json_encode($gd1fc8); l2cf0($parameters['entity'],$parameters['entity-id'],'remove',$d8c7dd); if (!mf0fb($d8c7dd)) { if(substr($d8c7dd,strrpos($d8c7dd,'.')) == '.mp3'){ @unlink(MEDIA_ROOT_FOLDER.AUDIO_FOLDER.$d8c7dd); } else { $tf1210=e2files__add_ext_prefix($d8c7dd,'thumb@2x'); $wf6347=@unlink(MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$d8c7dd); $s8f458=@unlink(MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER.$tf1210); } } die ($gd1fc8); } function yd10e(){ global$_config; if (!$_config['files_total_size_limit']) return false; $a70a36=0; foreach(glob(MEDIA_ROOT_FOLDER.PICTURES_FOLDER .'/*') as $d8c7dd){ $i9dd4e=stat($d8c7dd); $a70a36+=$i9dd4e['size']; } foreach(glob(MEDIA_ROOT_FOLDER.AUDIO_FOLDER .'/*') as $d8c7dd){ $i9dd4e=stat($d8c7dd); $a70a36+=$i9dd4e['size']; } $gd515a=$_config['files_total_size_limit']; $z354f0=round($a70a36/$gd515a*100); if ($a70a36 > 0 and $z354f0==0)$z354f0=1; if ($a70a36 < $gd515a and $z354f0==100)$z354f0=99; return array ($a70a36,$gd515a,$z354f0); } function w4f9d($hbd198,$o3667f){ return strcasecmp($hbd198,$o3667f)===0; } function x1363($hc999b){ $f85faf=true; if (list ($a70a36,$gd515a,$z354f0)=$hc999b){ $f85faf=($gd515a-$a70a36) > 0; } return $f85faf; } function zaf64($hc999b,$gf9f90=false){ $sf3ecb=''; if (list ($a70a36,$gd515a,$z354f0)=$hc999b){ $hc999b=array ( 'used' => round($a70a36/1024/1024), 'total' => round($gd515a/1024/1024), 'percent' => $z354f0 ); if ($gf9f90 or ($gd515a-$a70a36) < 1024*1024*10){ if ($a70a36 < $gd515a){ $sf3ecb=e2l_get_string('gs--used',$hc999b); } else { $sf3ecb=e2l_get_string('gs--used-all',$hc999b); } } } return $sf3ecb; } function e2files__find_free_filename($y85114,$j435ed){ if (!is_file($y85114.$j435ed)) return $j435ed; $pe12a7=e2files__extless($j435ed); $iabf77=substr($j435ed,strrpos($j435ed,'.')); $f865c0=0; while (is_file($y85114.$pe12a7 .'-'. (++$f865c0).$iabf77)); $j435ed=$pe12a7 .'-'. $f865c0.$iabf77; return $j435ed; } function e2files__add_ext_prefix($j435ed,$f3dbb8){ if ($f3dbb8){ $x80127=explode('/',$j435ed); $o954eb=array_pop($x80127); $z35b88=explode('.',$o954eb); if(count($z35b88) < 2)$z35b88[] = ''; $iabf77=array_pop($z35b88); $z35b88[] = $f3dbb8; if ($iabf77)$z35b88[] = $iabf77; $o954eb=implode('.',$z35b88); $x80127[] = $o954eb; $j435ed=implode('/',$x80127); } return $j435ed; } function e2files__extless($j435ed){ return substr($j435ed,0,strrpos($j435ed,'.')); } function e2files__find_free_filename_with_added_ext($y85114,$j435ed,$g3cedd){ $iabf77=pathinfo($j435ed,PATHINFO_EXTENSION); if (!strcasecmp($iabf77,$g3cedd)) return $j435ed; return e2files__find_free_filename($y85114,$j435ed .'.'. $g3cedd); } function e2_error404_mode(){ global$_config,$_strings; if($_config['try_redirect_to_all']) { $i4a7dc='all/'. urldecode($_GET['go']); sb7e9($i4a7dc); } header('HTTP/1.1 404 Not found'); $we70c4['class']='404'; $we70c4['heading']=$_strings['pt--page-not-found']; $we70c4['title']=$_strings['pt--page-not-found']; return $we70c4; } function u6f10($a1cb25){ include_once 'neasden/neasden.php'; $Nn=new Neasden; $Nn->profile_name='kavychki'; return$Nn->format($a1cb25); } function rc0c4($af2ffc,$a1cb25,$n5c18e){ include_once 'neasden/neasden.php'; if ($a1cb25==='') return array (); if ($af2ffc=='calliope'){ preg_match_all('/\(\(([^ ]*)( |\)\))/',$a1cb25,$j9c28d); return $j9c28d[1]; } elseif ($af2ffc=='neasden'){ $Nn=new Neasden; $Nn->profile_name=$n5c18e; $Nn->format($a1cb25); return$Nn->resources_detected; } else { return array (); } } function j154e($af2ffc,$a1cb25,$n5c18e){ include_once 'neasden/neasden.php'; if(Log::$ned2b5)__log('Format: format with formatter "'. $af2ffc .'" in context "'. $n5c18e.'"'); if ($af2ffc=='calliope'){ $a1cb25=medd9($a1cb25); $a1cb25=o5599($a1cb25,$n5c18e); $meta=array(); $a1cb25=ffd97($a1cb25); $a1cb25='<div class="e2-text-calliope-formatted">'. u6f10($a1cb25) .'</div>'; } elseif ($af2ffc=='neasden'){ $Nn=new Neasden; $Nn->profile_name=$n5c18e; $a1cb25=$Nn->format($a1cb25); $meta=array ( 'links-required' => $Nn->links_required, 'resources-detected' => $Nn->resources_detected ); } return array ( 'text-final' => $a1cb25, 'meta' => $meta, ); } function bb7f1($a1cb25,$n5c18e){ global$_config; return j154e($_config['default_formatter'],$a1cb25,$n5c18e); } function o5599($a1cb25,$n5c18e){ global$_config,$settings,$full_blog_url,$_template; @ (list ($n5c18e,$xe8fab)=explode('|',$n5c18e)); require_once 'calliope/WikiFormatter.php'; if ('full'==$n5c18e)$fad910=WF_FULL_MODE; elseif ('full-rss'==$n5c18e)$fad910=WF_FULL_MODE; elseif ('simple'==$n5c18e)$fad910=WF_SIMPLE_MODE; elseif ('simple-rss'==$n5c18e)$fad910=WF_SIMPLE_MODE; else return $a1cb25; $i0a1d3=new WikiFormatter(); $i0a1d3 -> replace=array ( '/' => 'i', '+' => 'small', '-' => 's', '*' => 'b', '^' => 'sup', 'v' => 'sub', '#' => 'tt', '!' => 'blockquote', ); $i0a1d3 -> settings=array ( 'hrefSize' => 100, 'localImgDir' => $full_blog_url .'/'. PICTURES_FOLDER, 'maxImgWidth' => $_template['max_image_width'], 'mode' => $fad910, 'enableShrinkLongHref' => 1, 'enableHr' => 0, 'enableBr' => 1, 'enableHeaders' => 1, 'headersStartWith' => 1, 'enableTables' => 1, 'simpleTableCSSClass' => 'e2-text-table', 'enableAutoAcronymEngine' => 0, 'enableAcronym' => 0, 'acronymBase' => '', 'enableList' => 1, 'mailSafe' => "<a href=\"\" onmouseover=\"this.href='mailto:'+{email}\">{icon}<script language=\"JavaScript\">document.write({name});</script></a>", 'ljUserTag' => '<a href="http://livejournal.com/users/{name}/">{name}</a>', 'fullVersionURL' => $xe8fab, 'enableTagIcons' => 0, 'outerUrlInNewWindow' => 0, 'lineBreak' => "\n", 'extLinkHrefPrefix' => '', ); $a1cb25=$i0a1d3 -> Wiki2HTML($a1cb25); return $a1cb25; } function gcc38($t572d4){ if(Log::$ned2b5)__log('Spawn: Curl '. $t572d4 .'...'); if(function_exists('curl_init')) { $vf6e57=curl_init(); $e80e25=!ini_get('open_basedir'); curl_setopt_array($vf6e57, array ( CURLOPT_URL => $t572d4, CURLOPT_CONNECTTIMEOUT => 300, CURLOPT_TIMEOUT => 1, CURLOPT_MAXREDIRS => 1, CURLOPT_COOKIE => pc3fb(), CURLOPT_SSL_VERIFYPEER => false, CURLOPT_FOLLOWLOCATION => $e80e25, CURLOPT_RETURNTRANSFER => true, CURLOPT_AUTOREFERER => true, CURLOPT_USERAGENT => E2_UA_STRING, )); $content=curl_exec($vf6e57); $u70106=curl_errno($vf6e57); $p809b1=curl_error($vf6e57); $q099fb=curl_getinfo($vf6e57); curl_close($vf6e57); if(Log::$ned2b5)__log('Spawn: Curl returns: ['. print_r($q099fb,true) .'] ['. $content .'], (errno='. $u70106 .', errstr='. $p809b1 .')...'); } else { if(Log::$ned2b5)__log('Spawn: Curl functions are not available'); } } function b5b68($oea59a){ global$_config; if (@$_config['broadcast_url'] and !$oea59a['IsExternal']) { if($_config['log_broadcast']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('broadcast'); } if(Log::$ned2b5)__log('Broadcast-async note: '. $oea59a['Title']); $t572d4=x83c8('e2m_note_broadcast', array ('*note' => $oea59a)); if(Log::$ned2b5)__log('Broadcast will spawn url: '. $t572d4); gcc38($t572d4); } } function m0d22($ecffbb){ global$_config; if (!$ecffbb) return false; $t572d4=$_config['broadcast_url']; $t572d4.='?src='. urlencode($ecffbb); if($_config['log_broadcast']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('broadcast'); } if(Log::$ned2b5)__log('Broadcast: Curl '. $t572d4 .'...'); if(function_exists('curl_init')) { $vf6e57=curl_init(); $e80e25=!ini_get('open_basedir'); curl_setopt_array($vf6e57, array ( CURLOPT_URL => $t572d4, CURLOPT_CONNECTTIMEOUT => 300, CURLOPT_TIMEOUT => 1, CURLOPT_MAXREDIRS => 1, CURLOPT_COOKIE => pc3fb(), CURLOPT_SSL_VERIFYPEER => false, CURLOPT_FOLLOWLOCATION => $e80e25, CURLOPT_RETURNTRANSFER => true, CURLOPT_AUTOREFERER => true, CURLOPT_USERAGENT => E2_UA_STRING, )); $content=curl_exec($vf6e57); $u70106=curl_errno($vf6e57); $p809b1=curl_error($vf6e57); $q099fb=curl_getinfo($vf6e57); curl_close($vf6e57); if(Log::$ned2b5)__log('Broadcast: Curl returns: ['. print_r($q099fb,true) .'] ['. $content .'], (errno='. $u70106 .', errstr='. $p809b1 .')...'); if ($u70106===0) return true; } else { if(Log::$ned2b5)__log('Spawn: Curl functions are not available'); } return false; } function ueb3b($oea59a){ if (!$oea59a) return false; $ecffbb=x83c8('e2m_note_json', array ('*note' => $oea59a)); return m0d22($ecffbb); } function e2m_note_broadcast($parameters=array ()) { global$_config; if (@$_config['broadcast_url']) { if(array_key_exists('*note',$parameters)) { $ecffbb=x83c8('e2m_note_json', array ('*note' => $parameters['*note'])); } elseif(array_key_exists('alias',$parameters)) { $ecffbb=x83c8('e2m_note_json', array ('alias' => $parameters['alias'])); } if (m0d22($ecffbb)) { die ('Broadcasted.'); } } else { return e2_error404_mode(); } } function e2m_timezone(){ global$_strings,$settings; $ode2fd=array ( 'form-action' => x83c8('e2s_select_timezone'), 'submit-text' => $_strings['fb--select'], 'timezone-selector' => l9fe5($settings['timezone']['offset'],1), 'dst?' => $settings['timezone']['is_dst'], ); return array ( 'title' => $_strings['pt--default-timezone'], 'heading' => $_strings['pt--default-timezone'], 'form' => 'form-timezone', 'form-timezone' => $ode2fd, ); } function u4c37(){ global$_strings; $q5cacd=array ( -720 => '', -660 => '', -600 => '', -540 => '', -480 => $_strings['tt--zone-pt'], -420 => $_strings['tt--zone-mt'], -360 => $_strings['tt--zone-ct'], -300 => $_strings['tt--zone-et'], -240 => '', -210 => '', -180 => '', -120 => '', -60 => '', 0 => $_strings['tt--zone-gmt'], 60 => $_strings['tt--zone-cet'], 120 => $_strings['tt--zone-eet'], 180 => '', 210 => '', 240 => $_strings['tt--zone-msk'], 270 => '', 300 => '', 330 => '', 345 => '', 360 => $_strings['tt--zone-ekt'], 390 => '', 420 => '', 480 => '', 540 => '', 570 => '', 600 => '', 660 => '', 720 => '', 780 => '', 840 => '', ); return $q5cacd; } function o82a3($v7a86c){ $q5cacd=u4c37(); return @$q5cacd[(int)$v7a86c/SECONDS_IN_A_MINUTE]; } function f9515($v7a86c){ $o04b29='+'; if ($v7a86c < 0)$o04b29='&ndash;'; $l73cdd=str_pad((int) (abs($v7a86c)/3600),2,'0',STR_PAD_LEFT); $p640fd=str_pad(abs($v7a86c)/60 % 60,2,'0',STR_PAD_LEFT); return 'GMT'. $o04b29.$l73cdd .':'. $p640fd; } function l9fe5($y0743a,$e5784d=''){ global$_strings; $q5cacd=u4c37(); $r2cb9d=''; if (!$e5784d)$e5784d=count($q5cacd); $r2cb9d.='<select class="e2-select" name="offset" size="'. $e5784d .'">'; foreach ($q5cacd as $v7a86c => $f83bce){ $pc03a8=''; if ($v7a86c*SECONDS_IN_A_MINUTE==$y0743a)$pc03a8=' selected="selected"'; $r2cb9d.='<option'. $pc03a8 .' value="'.$v7a86c.'">'; $o04b29=''; if ($v7a86c < 0)$o04b29=''; if ($v7a86c > 0)$o04b29='+'; $l73cdd=(int) (abs($v7a86c*SECONDS_IN_A_MINUTE)/3600); $p640fd=(int) (abs($v7a86c*SECONDS_IN_A_MINUTE)/60 % 60); if ($l73cdd){ $r2cb9d .= ( $o04b29 .' '. $l73cdd .' '. $_strings['gs--timezone-offset-hours'] .' '. ($p640fd? ($p640fd .' '. $_strings['gs--timezone-offset-minutes']) : '') ); if ($f83bce){ $r2cb9d .= ' ('. $f83bce. ')'; } } else { $r2cb9d .= $f83bce; } $r2cb9d.='</option>'; } $r2cb9d.='</select>'; return $r2cb9d; } function e2s_select_timezone(){ global$settings,$_strings; if (@$_POST['offset'] >= -720 and @$_POST['offset'] <= 780){ $settings['timezone']['offset'] = @$_POST['offset']*SECONDS_IN_A_MINUTE; $settings['timezone']['is_dst'] = isset ($_POST['is_dst']); } if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { q8a40($_strings['er--settings-not-saved'],E2E_PERMISSIONS_ERROR); e2_go_to(x83c8('e2m_timezone')); die; } e2_go_to(x83c8('e2m_settings')) and die (); } function l0923($saad65){ return array ( 'offset' => (int)$saad65['Offset'], 'is_dst' => (bool)$saad65['IsDST'], ); } function j3211(){ return array ( 'offset' => 0, 'is_dst' => false, ); } function g5c05(){ global$settings; if(array_key_exists('timezone',$settings)) { return$settings['timezone']; } else { return j3211(); } } function f7770($mb2c6c,$cdf491){ if (@$mb2c6c['is_dst']) { $e30481=(int)date('I',$cdf491); $s6b7ea=date('Z',$cdf491)-$e30481*SECONDS_IN_AN_HOUR; $s3e61a=$mb2c6c['offset']; $i178ae=$s3e61a-$s6b7ea; $u75b02=date('I',$cdf491+$i178ae); return $u75b02; } else { return 0; } } function vb2bf($mb2c6c,$cdf491){ global$settings; if ($mb2c6c and is_array($mb2c6c)) { return ( $mb2c6c['offset'] + f7770($mb2c6c,$cdf491)*SECONDS_IN_AN_HOUR ); } } function n8afe($cdf491){ return vb2bf(g5c05(),$cdf491); } function h5a2f($n1ddcb,$u4a202,$mb2c6c){ return gmdate($n1ddcb,$u4a202+vb2bf($mb2c6c,$u4a202)); } function qa846($n1ddcb,$u4a202){ return h5a2f($n1ddcb,$u4a202,g5c05()); } function w66cd($q41529,$t6f8f5=false,$r8277e=false){ if(is_numeric($r8277e)) { $dea2b2=gmmktime(0,0,0,$t6f8f5,$r8277e,$q41529); $j7f021=gmmktime(0,0,0,$t6f8f5,$r8277e+1,$q41529)-1; } elseif(is_numeric($t6f8f5)) { $dea2b2=gmmktime(0,0,0,$t6f8f5,1,$q41529); $j7f021=gmmktime(0,0,0,$t6f8f5+1,1,$q41529)-1; } else { $dea2b2=gmmktime(0,0,0,1,1,$q41529); $j7f021=gmmktime(0,0,0,1,1,$q41529+1)-1; } return array ($dea2b2,$j7f021); } function f2143($mb2c6c,$q41529,$t6f8f5=false,$r8277e=false){ list ($dea2b2,$j7f021)=w66cd($q41529,$t6f8f5,$r8277e); $dea2b2 -= vb2bf($mb2c6c,$dea2b2); $j7f021 -= vb2bf($mb2c6c,$j7f021); return array ($dea2b2,$j7f021); } function tac5b($q41529,$t6f8f5=false,$r8277e=false){ return f2143(g5c05(),$q41529,$t6f8f5,$r8277e); } function z5273($q41529,$t6f8f5=false,$r8277e=false){ $d32038=13; $oda4f0=-12; $d32038+=1; $oda4f0 -= 1; list ($dea2b2,$j7f021)=w66cd($q41529,$t6f8f5,$r8277e); $dea2b2 -= $d32038*3600; $j7f021 -= $oda4f0*3600; return array ($dea2b2,$j7f021); } function od17a($v7a86c){ if ((int) @$v7a86c > 0) return (string)'+'.abs(@$v7a86c); elseif ((int) @$v7a86c < 0) return (string)'-'.abs(@$v7a86c); else return ''; } function nd536($cdf491,$ma0f0b=''){ $v2ab64=n8afe($cdf491); $o04b29=($v2ab64 >= 0)?'+':'-'; $v2ab64=abs($v2ab64); $z03c7c=$v2ab64 % 60; $v2ab64 -= $z03c7c; $t6f8f5=$v2ab64 % 3600/60; $v2ab64 -= $t6f8f5*60; $o2510c=$v2ab64/3600; if ($o2510c < 10)$o2510c='0'.$o2510c; if ($t6f8f5 < 10)$t6f8f5='0'.$t6f8f5; return $o04b29.$o2510c.$ma0f0b.$t6f8f5; } function ja618($uaa759){ global$settings; if(is_numeric($uaa759)) { $result['offset']=SECONDS_IN_A_MINUTE*$uaa759; $result['is_dst']=false; $pd8935=SECONDS_IN_A_MINUTE*$uaa759-SECONDS_IN_AN_HOUR; $pa6cfc=array ('offset' => $pd8935,'is_dst' => true); $pa6cfc=(int)vb2bf($pa6cfc,time()); if($result['offset']==$pa6cfc){ $result['offset']=$pd8935; $result['is_dst']=true; } } else { if(array_key_exists('timezone',$settings)) { $result=$settings['timezone']; } else { $result['offset']=0; $result['is_dst']=false; } } return$result; } function m692f($k96b8c){ $o2510c=qa846('H',$k96b8c); if ($o2510c <= 4) return 4; elseif ($o2510c <= 10) return 1; elseif ($o2510c <= 16) return 2; elseif ($o2510c <= 22) return 3; else return 4; } function r7a0b($z0e524,$ob65f7=null){ global$_strings; if ($ob65f7===null)$ob65f7=g5c05(); $ydb42a=h5a2f('d.m.Y',$l97bc5,$ob65f7); $a33284=h5a2f('d.m.Y',$z0e524,$ob65f7); $ued79a=SECONDS_IN_A_MINUTE; $w77cbc=SECONDS_IN_AN_HOUR; $l97bc5=time(); $q0b375=m692f($l97bc5); $m3dfda=m692f($z0e524); $l74459=$l97bc5-$z0e524; if ($l74459 < 0) return$_strings['tt--from-the-future']; if ($l74459 >= 0 and $l74459 < 54) return$_strings['tt--just-now']; if ($l74459 >= 54 and $l74459 < 108) return$_strings['tt--one-minute-ago']; $w7eccb=$l74459+12; $h7828e=floor($w7eccb/$ued79a); if ($l74459 >= 108 and $l74459 < 54*$ued79a) return e2l_get_string( 'tt--minutes-ago', array ('minutes' => $h7828e) ); if ($l74459 >= 54*$ued79a and $l74459 < 108*$ued79a) return$_strings['tt--one-hour-ago']; $w7eccb=$l74459+12*$ued79a; $e6b497=floor($w7eccb/$w77cbc); if ($l74459 >= 108*$ued79a and $l74459 < 4*$w77cbc) return e2l_get_string( 'tt--hours-ago', array ('hours' => $e6b497) ); $g07cc6=h5a2f('G:i',$z0e524,$ob65f7); if ($l74459 >= 4*$w77cbc and $q0b375 > $m3dfda and $ydb42a==$a33284){ return$_strings['tt--today']; } if ((($l97bc5-$z0e524) <= 7884000)) { return e2l_get_string( 'tt--date', array ( 'day' => h5a2f('j',$z0e524,$ob65f7), 'month' => h5a2f('m',$z0e524,$ob65f7), ) ); } return h5a2f('Y',$z0e524,$ob65f7); } function y9093($z0e524,$ob65f7=null){ global$_strings; $l74459=time()-$z0e524; if ($l74459 < 0) return ''; if ($l74459==0) return$_strings['tt--now']; $cb98b3=array ( array (1,'tt--seconds-short'), array (SECONDS_IN_A_MINUTE,'tt--minutes-short'), array (SECONDS_IN_AN_HOUR,'tt--hours-short'), array (SECONDS_IN_A_DAY,'tt--days-short'), array (SECONDS_IN_A_MONTH,'tt--months-short'), array (SECONDS_IN_A_YEAR,'tt--years-short'), array (SECONDS_IN_A_YEAR+SECONDS_IN_A_MONTH,''), ); for ($f865c0=0; $f865c0 < count($cb98b3); ++ $f865c0){ if ($l74459 >= $cb98b3[$f865c0][0] and $l74459 < $cb98b3[$f865c0+1][0]) { return e2l_get_string( $cb98b3[$f865c0][1], array ('value' => floor($l74459/$cb98b3[$f865c0][0])) ); } } if ($ob65f7===null)$ob65f7=g5c05(); return h5a2f('Y',$z0e524,$ob65f7); } $_model_contractions=array ( 'key' => "INT UNSIGNED AUTO_INCREMENT PRIMARY KEY", 'pkey' => "INT UNSIGNED DEFAULT '0' NOT NULL", 'int' => "INT DEFAULT '0' NOT NULL", 'uint' => "INT UNSIGNED DEFAULT '0' NOT NULL", 'time' => "INT UNSIGNED DEFAULT '0' NOT NULL", '0' => "TINYINT(1) DEFAULT '0' NOT NULL", '1' => "TINYINT(1) DEFAULT '1' NOT NULL", 'v1' => "VARCHAR(1) DEFAULT '' NOT NULL", 'v8' => "VARCHAR(8) DEFAULT '' NOT NULL", 'v15' => "VARCHAR(15) DEFAULT '' NOT NULL", 'v32' => "VARCHAR(32) DEFAULT '' NOT NULL", 'v64' => "VARCHAR(64) DEFAULT '' NOT NULL", 'fid' => "VARCHAR(32) DEFAULT '". $_config['default_formatter'] ."' NOT NULL", 'v255' => "VARCHAR(255) DEFAULT '' NOT NULL", 'text' => "MEDIUMTEXT", ); $_model=array ( 'Actions' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('EntityID', 'pkey'), array ('Stamp', 'time'), array ('ReadCount', 'int'), ), 'Aliases' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('EntityType', 'v1'), array ('EntityID', 'pkey'), array ('Alias', 'v64'), array ('Stamp', 'time'), ), 'Comments' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('NoteID', 'pkey'), array ('AuthorName', 'v255'), array ('AuthorEmail', 'v255'), array ('Text', 'text'), array ('Reply', 'text'), array ('IsVisible', '1'), array ('IsFavourite', '0'), array ('IsReplyVisible', '0'), array ('IsReplyFavourite', '0'), array ('IsAnswerAware', '1'), array ('IsSubscriber', '0'), array ('IsSpamSuspect', '0'), array ('IsNew', '0'), array ('Stamp', 'time'), array ('LastModified', 'time'), array ('ReplyStamp', 'time'), array ('ReplyLastModified', 'time'), array ('IP', 'v15'), array ('IsGIPUsed', '0'), array ('GIP', 'v15'), array ('GIPAuthorID', 'v64'), ), 'Keywords' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('Keyword', 'v255'), array ('OriginalAlias', 'v64'), array ('PageTitle', 'v255'), array ('Description', 'text'), array ('Uploads', 'text'), array ('IsFavourite', '0'), ), 'Notes' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('Title', 'v255'), array ('Text', 'text'), array ('FormatterID', 'fid'), array ('OriginalAlias', 'v64'), array ('Uploads', 'text'), array ('IsPublished', '0'), array ('IsCommentable', '0'), array ('IsVisible', '1'), array ('IsFavourite', '0'), array ('Stamp', 'time'), array ('LastModified', 'time'), array ('Offset', 'int'), array ('IsDST', '0'), array ('IsIndexed', '0'), array ('IsExternal', '0'), array ('SourceID', 'pkey'), array ('SourceNoteID', 'pkey'), array ('SourceNoteURL', 'v255'), array ('SourceNoteJSONURL', 'v255'), array ('SourceNoteData', 'text'), ), 'NotesKeywords' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('NoteID', 'pkey'), array ('KeywordID', 'pkey'), ), 'GIPsSessions' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('GIP', 'v15'), array ('GIPAuthorID', 'v64'), array ('AuthorName', 'v255'), array ('AuthorEmail', 'v255'), array ('AuthorProfileLink', 'v255'), array ('SessionToken', 'v255'), array ('Stamp', 'time'), ), 'Sources' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('TrueID', 'pkey'), array ('Title', 'v255'), array ('AuthorName', 'v255'), array ('URL', 'v255'), array ('PictureURL', 'v255'), array ('IsWhiteListed', '0'), array ('IsTrusted', '0'), ), ); $_model_indexes=array ( 'Actions' => array ( "UNIQUE INDEX (`EntityID`, `Stamp`)", ), 'Aliases' => array ( "INDEX (`Alias`)", "INDEX (`EntityID`)", ), 'Comments' => array ( "INDEX (`NoteID`)", ), 'Keywords' => array (), 'GIPsSessions' => array ( "UNIQUE INDEX (`GIP`, `GIPAuthorID`)" ), 'Notes' => array ( "FULLTEXT (`Title`, `Text`)", "INDEX (`Stamp`)", "INDEX (`SourceID`)", "INDEX (`SourceNoteID`)", ), 'NotesKeywords' => array ( "INDEX (`NoteID`)", ), ); $_model_minimal_table_list=array ( 'Comments', 'Keywords', 'Notes', 'NotesKeywords', ); function e2_model_data_check($y11e0e){ global$_db,$_model,$_model_minimal_table_list,$_config; $p08cfc=false; $k35f9b=array(); $lac5c7='SHOW TABLES FROM `'. mysqli_real_escape_string($_db['link'],$y11e0e). '`'; $result=mysqli_query($_db['link'],$lac5c7); if($result){ while ($mf1965=mysqli_fetch_row($result)) { foreach(array_keys($_model) as $yd2ffa){ if(strcasecmp($mf1965[0],$_config['db_table_prefix'].$yd2ffa)===0){ $p08cfc=true; $k35f9b[] = $yd2ffa; } } } } $ld9a22=true; foreach(array_keys($_model) as $yd2ffa){ if (!in_array($yd2ffa,$k35f9b)) { $ld9a22=false; } } $g7ec6f=true; foreach($_model_minimal_table_list as $yd2ffa){ if (!in_array($yd2ffa,$k35f9b)) { $g7ec6f=false; } } return array ( 'occupied' => $p08cfc, 'complete' => $ld9a22, 'migrateable' => $g7ec6f, ); } function jb154($ccf1e8,$oee11c,$g5f4dc){ global $k11755; if (($q2a304=mysqli_connect($ccf1e8,$oee11c,$g5f4dc)) === false) return []; $ve61ce=[]; $g00a90=[ 'information_schema', 'performance_schema', 'sys', 'mysql' ]; @$k11755 ++; $b1b1cc='SHOW DATABASES'; if(Log::$ned2b5)__log('DB ['. $k11755 .']: '. $b1b1cc); $result=mysqli_query($q2a304,$b1b1cc); while ($mf1965=mysqli_fetch_row($result)) { if(mysqli_select_db($q2a304,$mf1965[0]) and !in_array($mf1965[0],$g00a90)) { $ve61ce[] = $mf1965[0]; } } return $ve61ce; } function r4e1c($oaab9e){ global$_config; u0738( "SHOW TABLES LIKE '". $_config['db_table_prefix'].$oaab9e . "'" ); $s9b207=d0d6b(); return count($s9b207) > 0; } function m07e3($oaab9e,$e851f5=null){ global$_config; if ($e851f5===null){ $e851f5=$_config['db_table_prefix']; } u0738( "SHOW TABLE STATUS LIKE '". $e851f5.$oaab9e . "'" ); $result=d0d6b(); return$result?$result[0] : []; } function kf1ac($oaab9e){ global$_model,$_model_contractions,$_model_indexes,$_config,$_db; if (!array_key_exists($oaab9e,$_model)) throw new AeModelUnknownTableException(); if (r4e1c($oaab9e)) return; $e851f5=$_config['db_table_prefix']; $i54ca8=array(); foreach($_model[$oaab9e] as $u1afd3){ list ($vb0689,$type)=$u1afd3; $i54ca8[] = "`". $vb0689 ."` ". $_model_contractions[$type]; } u0738( "CREATE TABLE `". $e851f5.$oaab9e ."` ". "(". implode(" ,",$i54ca8) .") ". "ENGINE=MyISAM DEFAULT CHARSET=". $_db['charset'] ); if(is_array(@$_model_indexes[$oaab9e])) { foreach($_model_indexes[$oaab9e] as $f6a992){ u0738( "ALTER TABLE `". $e851f5.$oaab9e ."` ". "ADD ". $f6a992 ); } } } function v9943($oaab9e,$sde17f,$ob512d='INSERT',$o07ccf=''){ global$_config,$_db; $j8688e['SubsetID']=$_config['db_table_subset']; foreach ($sde17f as $d8ce4b => $t9e366){ $j8688e[$d8ce4b]="'". a7928($t9e366) ."'"; } $fd05b6="`". implode("`, `",array_keys($j8688e)). "`"; $zf09cc=implode(", ",array_values($j8688e)); u0738( $ob512d ." INTO `". $_config['db_table_prefix'].$oaab9e ."` ". "(".$fd05b6 .") VALUES (". $zf09cc .")". ($o07ccf? (' '. $o07ccf):'') ); $sde17f['ID']=mysqli_insert_id($_db['link']); return $sde17f; } function qaa79($oaab9e,$sde17f,$d7692d=false,$o0f543=false){ global$_config,$_e2_day_numbers_by_note_id; $_e2_day_numbers_by_note_id=[]; if(Log::$ned2b5)__log('Model: update record in table '. $oaab9e .' {'); $w6a7f2=array(); foreach(e2model__soft_fields_for_table_($oaab9e) as $s06e3d){ if(array_key_exists($s06e3d,$sde17f)) { $w6a7f2[] = '`'. $s06e3d .'`'."='". a7928($sde17f[$s06e3d]) ."'"; } } $eb5b39=array(); if(is_array($d7692d)) { foreach(e2model__soft_fields_for_table_($oaab9e) as $s06e3d){ if(array_key_exists($s06e3d,$d7692d)) { $eb5b39[] = '`'. $s06e3d .'`'."='". a7928($d7692d[$s06e3d]) ."'"; } } } if(count($eb5b39)) { $o56790=implode(" AND ",$eb5b39); } else { if (!array_key_exists('ID',$sde17f) or !is_numeric($sde17f['ID'])) { if(Log::$ned2b5)__log('Error: e2_update_record must be called with an ID field in $record when updating single row'); return false; } $o56790="`ID`=". $sde17f['ID']; } if(count($w6a7f2) > 0){ $c91179=$o0f543? 'LOW_PRIORITY ':''; u0738( "UPDATE ". $c91179 ."`". $_config['db_table_prefix'].$oaab9e ."` ". "SET ". implode(', ',$w6a7f2) ." ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (". $o56790 .")" ); } if(Log::$ned2b5)__log('}'); return true; } function e2model__soft_fields_for_table_($oaab9e){ global$_model; $r2cb9d=array(); if(array_key_exists($oaab9e,$_model)) { foreach($_model[$oaab9e] as $s06e3d){ if (!in_array($s06e3d[1], array ('key'))) { $r2cb9d[] = $s06e3d[0]; } } } return $r2cb9d; } function e2m_install(){ global$_strings,$_superconfig,$_files_written,$_diagnose; if (n2ac5()!==null)e2_go_to() and die; udb82(DEFAULT_TEMPLATE); $r2cb9d=array(); if($_superconfig['disallow_installer']) { die ('Installer disabled by superconfig'); } if(Log::$ned2b5)__log('Installer: not installed, present user with form'); $le26af=true; $yd77d5['server'] = @$_COOKIE[v8c3b('install_db_server')]; $yd77d5['user_name'] = @$_COOKIE[v8c3b('install_db_user_name')]; $yd77d5['passw']=iee85(@$_COOKIE[v8c3b('install_db_passw')]); $yd77d5['name'] = @$_COOKIE[v8c3b('install_db_name')]; if (!@isset ($_diagnose['ok?']))k8739(); if (!$_diagnose['ok?']) { if(Log::$ned2b5)__log('Installer: problems, tell user'); $le26af=false; } $r2cb9d=[ 'title' => $_strings['pt--install'], 'heading' => $_strings['pt--install'], 'form-install' => [ 'form-action' => x83c8('e2s_install'), 'form-check-db-config-action' => x83c8('e2j_check_db_config'), 'form-list-databases-action' => x83c8('e2j_list_databases'), 'installation-possible?' => $le26af, 'submit-text' => $_strings['fb--begin'], 'retry-href' => x83c8('e2m_install'), 'retry-text' => $_strings['fb--retry'], 'db-server' => htmlspecialchars(@$yd77d5['server']? $yd77d5['server']:'localhost'), 'db-user' => htmlspecialchars(@$yd77d5['user_name']? $yd77d5['user_name']:'root'), 'db-password' => '', 'db-database' => htmlspecialchars(@$yd77d5['name']), ] ]; return $r2cb9d; } function n2ac5(){ static $c7123a=null; if ($c7123a===null){ $c7123a=@unserialize( @file_get_contents(USER_FOLDER.'instance.psa') ) or $c7123a=null; } return $c7123a; } function s5be8($x2af72){ static $c7123a=null; $c7123a=n2ac5(); $c7123a['version']=$x2af72; if (k6e52(USER_FOLDER. '/instance.psa',serialize($c7123a))) { return $c7123a; } else { die ('Cannot instantiate v'. $x2af72 .': probably permission denied'); } } function e2s_instantiate($parameters){ global$_strings; if (n2ac5()!==null){ die ('Remove the file "'. USER_FOLDER .'instance.psa" first'); } else { if(is_numeric($parameters['version'])) { if (s5be8($parameters['version'])) { q8a40($_strings['gs--instantiated-version'] .' v'. $parameters['version'],E2E_MESSAGE); e2_go_to(x83c8('e2m_frontpage', array ('page' => 1))); die; } } } die ('Could not create instance of engine'); } function e2_install($s8d777){ global$_folders_written,$_strings,$_config,$settings; if (n2ac5()!==null){ throw new AeInstallAlreadyInstalledException('Instance already created'); } if($_config['log_installs']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('install-$'); } if(Log::$ned2b5)__log('Installer: force directories'); foreach($_folders_written as $z45684){ @eaf42($z45684); } if(Log::$ned2b5)__log('Installer: write password hash'); if (!@k6e52(USER_FOLDER.'password-hash.psa',serialize(sha1($s8d777['password'])))) { throw new AePasswordHashNotSavedException; } if(array_key_exists('plain_password',$s8d777['db_params'])) { $s8d777['db_params']['passw']=n1305($s8d777['db_params']['plain_password']); unset ($s8d777['db_params']['plain_password']); } $settings['db']=$s8d777['db_params']; $settings['template']=DEFAULT_TEMPLATE; $settings['language']=DEFAULT_LANGUAGE; q985b('check database during installation',$s8d777['db_params']); $aaae42=e2_model_data_check($s8d777['db_params']['name']); $lf2b28=false; if ($aaae42['occupied']) { if ($aaae42['migrateable'] and $s8d777['allow_migration']) { $lf2b28=true; if(Log::$ned2b5)__log('Installer: data exists and migrateable'); } else { if(Log::$ned2b5)__log('Installer: incomplete data in the database'); throw new AeInstallDatabaseOccupiedException('Database already has some data'); } } if ($lf2b28){ if(Log::$ned2b5)__log('Installer: no need to create tables, will migrate'); try { cbb8d(); } catch (AeMySQLException $e){ b12f6($e,'Could not migrate'); q8a40($_strings['er--double-check-db-params']); } } else { if(Log::$ned2b5)__log('Installer: create tables'); kf1ac('Notes'); kf1ac('Comments'); kf1ac('Keywords'); kf1ac('NotesKeywords'); kf1ac('Aliases'); kf1ac('Actions'); kf1ac('Sources'); kf1ac('GIPsSessions'); } if(Log::$ned2b5)__log('Installer: write settings'); if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { throw new AeSettingsNotSavedException; } e2_drop_all_kinds_of_cache(); if(Log::$ned2b5)__log('Installer: search index'); $fddece=a476c(); try { $fddece -> erase(); } catch (\S2\Rose\Exception\RuntimeException $e){ if(Log::$ned2b5)__log('Installer: Rose not available'); } c198f(); if(Log::$ned2b5)__log('Installer: instantiate'); s5be8(E2_VERSION); if(Log::$ned2b5)__log('Installer: complete'); } function e91a0(){ $d78940['server']=$d78940['user_name'] = $d78940['passw']=$d78940['name']=''; if(array_key_exists('db-server',$_POST)) $d78940['server']=$_POST['db-server']; if(array_key_exists('db-user',$_POST)) $d78940['user_name']=$_POST['db-user']; if(array_key_exists('db-password',$_POST))$d78940['passw']=$_POST['db-password']; if(array_key_exists('db-database',$_POST))$d78940['name']=$_POST['db-database']; return $d78940; } function e2s_install(){ global$_strings,$_config,$_db; if (n2ac5()!==null)e2_go_to() and die; $d78940=e91a0(); foreach ($d78940 as $d8ce4b => $t9e366){ ic64a('install_db_'. $d8ce4b,$t9e366); } if (!array_key_exists('password',$_POST) or trim($_POST['password']) == ''){ q8a40($_strings['er--no-password-entered'],E2E_USER_ERROR); e2_go_to(x83c8('e2m_install')); die; } $u88162=trim($_POST['password']); @session_start(); $pad3da=false; try { e2_install([ 'allow_migration' => true, 'password' => $u88162, 'db_params' => $d78940, ]); $pad3da=true; } catch (AeMySQLCannotConnectException $e){ q8a40( $_strings['er--cannot-connect-to-db']. ':<br />'. mysqli_connect_error() .' ('. mysqli_connect_errno() .')' ); } catch (AeMySQLTooOldException $e){ q8a40(e2l_get_string('er--mysql-version-too-old', [ 'v1' => $_db['version'], 'v2' => E2_MINIMUM_MYSQL, ])); } catch (AeMySQLException $e){ q8a40($_strings['er--cannot-find-db'] .' '. $d78940['name']); } catch (AeInstallDatabaseOccupiedException $e){ q8a40($_strings['er--db-data-incomplete-install']); } catch (AeNotSavedException $e){ q8a40($_strings['er--settings-not-saved'],E2E_PERMISSIONS_ERROR); } catch (AeInstallException $e){ } if (!$pad3da){ e2_go_to(x83c8('e2m_install')); die; } $t2d6d8['sessions'] = [[ 'stamp' => time(), 'remote_ip' => p1668(), 'key_hash' => qe8ed(true), 'ua' => $_SERVER['HTTP_USER_AGENT'], ]]; if (!z1d21($t2d6d8)) { q8a40($_strings['er--cannot-write-auth-data'],E2E_PERMISSIONS_ERROR); } gcc38(x83c8('e2s_bsi_step', array ())); e2_go_to(); die; } function hd660(){ global $x57de2,$ra57c1,$_superconfig,$_config; $c7123a=n2ac5(); if (n2ac5()!==null){ if(E2_VERSION < $c7123a ['version']) { if (@$_config['dev_ignore_version_mismatch']) return; if(Log::$ned2b5)__log('Installer: cannot downdate'); header('HTTP/1.1 503 Service Unavailable'); die ('E2 does not support automatic downgrade.'); } elseif(E2_VERSION > $c7123a ['version']) { if(Log::$ned2b5)__log('Installer: need to update'); header('Location: http://'. $x57de2.$ra57c1 .'/perform_update/'); header('Location: '. x83c8('e2s_update_perform')); die; } else { return; } } if(Log::$ned2b5)__log('Installer: not installed {'); if ((strpos($_SERVER['SERVER_SOFTWARE'],'Apache')===0)) { if(Log::$ned2b5)__log('Installer: running on Apache'); $uefe79=DEFAULTS_FOLDER.'default.htaccess'; $nd5c54=false; if (!is_file($uefe79)) { echo 'File not found: '.$uefe79. '. Please use the full E2 installation package.'; die; } if(is_file('.htaccess')) { if(Log::$ned2b5)__log('Installer: there is a .htaccess file in the installation directory'); $pe6f97=file_get_contents($uefe79); $xc6680=file_get_contents('.htaccess'); if ($xc6680!=$pe6f97){ $nd5c54=true; $k6a9d4=$qd1813='.htaccess.old'; $n3c549=1; while (is_file($qd1813)) { $qd1813=$k6a9d4 .'.'. $n3c549 ++; } if(Log::$ned2b5)__log('Installer: existing .htaccess wrong, backing up as <'. $qd1813 .'>'); if (!@rename('.htaccess',$qd1813)) { if(Log::$ned2b5)__log('Installer: fuck'); echo 'Looks like you are using Apache and have put an incorrect ".htaccess" file in the installation directory. Additionally, the installer was not able to back up your existing ".htaccess" file in order to replace it with the correct one. Please use the full E2 installation package and grant write access on the installation target directory, all the files and subdirectories.'; die; } } } else { $nd5c54=true; } if ($nd5c54){ if(Log::$ned2b5)__log('Installer: writing a correct .htaccess file'); if (!@copy($uefe79,'.htaccess')) { if(Log::$ned2b5)__log('Installer: fuck'); echo 'The installer was not able to create a correct ".htaccess" file. Please grant write access on the installation target directory.'; die; } } } if($_superconfig['disallow_installer']) { if(Log::$ned2b5)__log('Installer: disallowed in superconfig'); q4aff(new AeNotAndCannotBeInstalledException); } else { $m601f0=x83c8('e2m_install'); if(Log::$ned2b5)__log('Installer: will need to install, going to '. $m601f0); if(Log::$ned2b5)__log('}'); e2_go_to($m601f0); die; } } function e2j_check_db_config(){ global$_db,$_strings; $d78940=e91a0(); $gd1fc8=[ 'success' => true, 'data' => [ 'message' => '', 'db-responding' => false, 'db-connected' => false, 'db-compatible' => false, 'db-occupied' => false, 'db-migrateable' => false, ] ]; try { $d78940['passw']=n1305($d78940['passw']); q985b('connect to check DB config (try 1)',$d78940); } catch (AeMySQLAccessDeniedException $e){ $gd1fc8['data']['db-responding']=true; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } catch (AeMySQLCannotConnectException $e){ $gd1fc8['data']['message']='no-connect'; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } catch (AeMySQLTooOldException $e){ $gd1fc8['data']['db-responding']=true; $gd1fc8['data']['db-connected']=true; $gd1fc8['data']['message']=e2l_get_string('er--mysql-version-too-old', [ 'v1' => $_db['version'], 'v2' => E2_MINIMUM_MYSQL, ]); $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } catch (AeMySQLNotFoundException $e){ $gd1fc8['data']['db-responding']=true; $gd1fc8['data']['db-connected']=true; if (!$d78940['name']) { $ve61ce=jb154( $d78940['server'],$d78940['user_name'],$d78940['passw'] ); if(count($ve61ce) > 0){ $d78940['name']=$ve61ce[0]; } else { $gd1fc8['data']['db-responding']=true; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } } } $gd1fc8['data']['db-responding']=true; $gd1fc8['data']['db-connected']=true; $gd1fc8['data']['db-compatible']=true; try { q985b('connect to check DB config (try 2)',$d78940); } catch (AeMySQLException $e){ $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } $gd1fc8['data']['db-good']=true; $aaae42=e2_model_data_check($d78940['name']); if ($aaae42['occupied']) { if ($aaae42['migrateable']) { $gd1fc8['data']['message']=$_strings['gs--data-exists']; } else { $gd1fc8['data']['db-good']=false; $gd1fc8['data']['message']=$_strings['er--db-data-incomplete-install']; } } $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } function e2j_list_databases(){ $d78940=e91a0(); $ve61ce=jb154( $d78940['server'],$d78940['user_name'],$d78940['passw'] ); $gd1fc8=[ 'success' => true, 'data' => [ 'databases-list' => $ve61ce, ] ]; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } function cbb8d(){ global$_db,$_config,$_model; $e851f5=$_config['db_table_prefix']; u0738('SET sql_quote_show_create=1'); if($_db['charset']==='utf8mb4'){ if(Log::$ned2b5)__log('Convert tables to utf8 or utf8mb4 {'); rb01c($e851f5); if(Log::$ned2b5)__log('}'); } else { if(Log::$ned2b5)__log('Convert tables to utf8 or utf8 {'); ldb59($e851f5); if(Log::$ned2b5)__log('}'); } if(Log::$ned2b5)__log('Get existing table information {'); foreach(array_keys($_model) as $oaab9e){ kf1ac($oaab9e); try { u0738("SHOW CREATE TABLE `". $e851f5.$oaab9e ."`"); $h4fded[$oaab9e]=d0d6b(); $h4fded[$oaab9e]=$h4fded[$oaab9e][0]['Create Table']; } catch (AeMySQLException $e){ b12f6($e); die ('Database table "'. $e851f5 .$oaab9e .'" not accessible during migration. Check your database availability'); } u0738("SHOW INDEX FROM `". $e851f5.$oaab9e ."`"); $i62699=d0d6b(); $r43eef=array(); foreach ($i62699 as $f6a992){ $f6a992=$f6a992['Key_name']; if(preg_match('/\_[0-9]+$/',$f6a992)) { $r43eef[] = 'DROP INDEX '. $f6a992; } } if(count($r43eef)) { $r43eef=implode(', ',array_unique($r43eef)); u0738( "ALTER TABLE  `". $e851f5.$oaab9e ."` ". $r43eef ); } } if(Log::$ned2b5)__log('}'); if (!strstr($h4fded['Notes'],'`FormatterID`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `FormatterID` VARCHAR( 32 ) DEFAULT 'calliope' NOT NULL AFTER `Text`" ); } if (!strstr($h4fded['Notes'],'`OriginalAlias`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "CHANGE `URLName` `OriginalAlias` VARCHAR( 64 ) DEFAULT '' NOT NULL AFTER `FormatterID`" ); } if (!strstr($h4fded['Notes'],'KEY `Stamp` (`Stamp`)')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD INDEX (`Stamp`);" ); } if(strstr($h4fded['Notes'],'`IP`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "DROP `IP`" ); } if (!stristr($h4fded['Notes'],'`Text` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "CHANGE `Text` `Text` MEDIUMTEXT" ); } if (!strstr($h4fded['Notes'],'`IsIndexed`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `IsIndexed` TINYINT( 1 ) DEFAULT '0' NOT NULL AFTER `IsDST`" ); } if (!strstr($h4fded['Notes'],'`Uploads`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `Uploads` MEDIUMTEXT AFTER `OriginalAlias`" ); } if (!stristr($h4fded['Notes'],'`Uploads` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "CHANGE `Uploads` `Uploads` MEDIUMTEXT" ); } if (!strstr($h4fded['Notes'],'`IsExternal`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `IsExternal` TINYINT(1) DEFAULT '0' NOT NULL AFTER `IsIndexed`" ); } if (!strstr($h4fded['Notes'],'`SourceID`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SourceID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `IsExternal`" ); } if (!strstr($h4fded['Notes'],'`SourceNoteID`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SourceNoteID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `SourceID`" ); } if (!strstr($h4fded['Notes'],'`SourceNoteURL`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SourceNoteURL` VARCHAR(255) DEFAULT '' NOT NULL AFTER `SourceNoteID`" ); } if (!strstr($h4fded['Notes'],'`SourceNoteData`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SourceNoteData` MEDIUMTEXT AFTER `SourceNoteURL`" ); } if (!strstr($h4fded['Notes'],'`SourceNoteJSONURL`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SourceNoteJSONURL` VARCHAR(255) DEFAULT '' NOT NULL AFTER `SourceNoteData`" ); } if(strstr($h4fded['Notes'],'`SourceMainImageURL`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "DROP `SourceMainImageURL`" ); } if (!strstr($h4fded['Notes'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if(strstr($h4fded['Notes'],'`IsIssue`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "DROP `IsIssue`" ); } if (!strstr($h4fded['Notes'],'KEY `SourceID` (`SourceID`)')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD INDEX (`SourceID`);" ); } if (!strstr($h4fded['Notes'],'KEY `SourceNoteID` (`SourceNoteID`)')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD INDEX (`SourceNoteID`);" ); } if (!strstr($h4fded['Comments'],'KEY `NoteID` (`NoteID`)')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "ADD INDEX (`NoteID`);" ); } if (!stristr($h4fded['Comments'],'`Text` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "CHANGE `Text` `Text` MEDIUMTEXT" ); } if (!stristr($h4fded['Comments'],'`Reply` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "CHANGE `Reply` `Reply` MEDIUMTEXT" ); } if (!strstr($h4fded['Comments'],'`IsGIPUsed`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "ADD `IsGIPUsed` TINYINT(1) DEFAULT '0' NOT NULL AFTER `IP`" ); } if (!strstr($h4fded['Comments'],'`GIP`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "ADD `GIP` VARCHAR(15) DEFAULT '' NOT NULL AFTER `IsGIPUsed`" ); } if (!strstr($h4fded['Comments'],'`GIPAuthorID`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "ADD `GIPAuthorID` VARCHAR(64) DEFAULT '' NOT NULL AFTER `GIP`" ); } if (!strstr($h4fded['Comments'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if(strstr($h4fded['Comments'],'`SocialType`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "DROP `SocialType`" ); } if(strstr($h4fded['Comments'],'`SocialID`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "DROP `SocialID`" ); } if (!strstr($h4fded['Keywords'],'`OriginalAlias`')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "CHANGE `URLName` `OriginalAlias` VARCHAR( 64 ) DEFAULT '' NOT NULL AFTER `Keyword`" ); } if (!stristr($h4fded['Keywords'],'`Description` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "CHANGE `Description` `Description` MEDIUMTEXT" ); } if (!strstr($h4fded['Keywords'],'`Uploads`')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "ADD `Uploads` MEDIUMTEXT AFTER `Description`" ); } if (!strstr($h4fded['Keywords'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if (!strstr($h4fded['Keywords'],'`PageTitle`')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "ADD `PageTitle` VARCHAR(255) DEFAULT '' NOT NULL AFTER `OriginalAlias`" ); } if (!stristr($h4fded['Keywords'],'`Uploads` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "CHANGE `Uploads` `Uploads` MEDIUMTEXT" ); } if(strstr($h4fded['Keywords'],'`ParentKeywordID`')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "DROP `ParentKeywordID`" ); } if (!strstr($h4fded['NotesKeywords'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."NotesKeywords` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if (!strstr($h4fded['Aliases'],'KEY `Alias` (`Alias`)')) { u0738( "ALTER TABLE `". $e851f5."Aliases` ". "ADD INDEX (`Alias`);" ); } if (!strstr($h4fded['Aliases'],'KEY `EntityID` (`EntityID`)')) { u0738( "ALTER TABLE `". $e851f5."Aliases` ". "ADD INDEX (`EntityID`);" ); } if (!strstr($h4fded['Aliases'],'`EntityType`')) { u0738( "ALTER TABLE `". $e851f5."Aliases` ". "ADD `EntityType` VARCHAR( 1 ) DEFAULT '' NOT NULL AFTER `ID`" ); } if (!strstr($h4fded['Aliases'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Aliases` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } u0738( "UPDATE `". $e851f5."Aliases` ". "SET `EntityType` = 'n' ". "WHERE `EntityType` = ''" ); if (!strstr($h4fded['Actions'],'`ReadCount`')) { u0738( "ALTER TABLE `". $e851f5."Actions` ". "ADD `ReadCount` INT DEFAULT '0' NOT NULL" ); } if (!strstr($h4fded['Actions'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Actions` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if(strstr($h4fded['Actions'],'`HitCount`')) { u0738( "ALTER TABLE `". $e851f5."Actions` ". "DROP `HitCount`" ); u0738( "DELETE FROM `". $e851f5."Actions` ". "WHERE `ReadCount` = 0" ); } if (!strstr($h4fded['GIPsSessions'],'`AuthorEmail`')) { u0738( "ALTER TABLE `". $e851f5."GIPsSessions` ". "ADD `AuthorEmail` VARCHAR(255) DEFAULT '' NOT NULL AFTER `AuthorName`" ); } if (!strstr($h4fded['GIPsSessions'],'`AuthorProfileLink`')) { u0738( "ALTER TABLE `". $e851f5."GIPsSessions` ". "ADD `AuthorProfileLink` VARCHAR(255) DEFAULT '' NOT NULL AFTER `AuthorEmail`" ); } if (!strstr($h4fded['GIPsSessions'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."GIPsSessions` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if (!strstr($h4fded['Sources'],'`TrueID`')) { u0738( "ALTER TABLE `". $e851f5."Sources` ". "ADD `TrueID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); u0738( "UPDATE `". $e851f5."Sources` ". "SET `TrueID` = `ID`" ); } if (!strstr($h4fded['Sources'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Sources` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } return true; } function ldb59($e851f5){ global$_model; foreach(array_keys($_model) as $yd2ffa){ $x4b43b=m07e3($yd2ffa,$e851f5); if ($x4b43b){ $id89e2=$x4b43b['Collation']; if ($id89e2!='utf8_general_ci'){ if(Log::$ned2b5)__log('Migrate: Convert table '. $yd2ffa. ' to utf8'); u0738( "ALTER TABLE `". $e851f5.$yd2ffa ."` ". "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" ); } } } } function e2mig__queries_to_recreate_indexes_for_table_($oaab9e){ $ef78dd=$i4f12d=[]; $r7694f=( "SELECT s.column_name, s.table_name, s.index_name, s.non_unique ". "FROM information_schema.statistics s ". " JOIN information_schema.columns USING (table_name, table_schema, column_name) ". " JOIN information_schema.tables USING (table_name, table_schema) ". "WHERE s.table_schema = DATABASE() AND engine = 'InnoDB' ". " AND column_type like '%varchar%' AND table_name='".$oaab9e."'" ); u0738($r7694f); foreach (d0d6b() as $mf1965){ $ef78dd[] = sprintf( "DROP INDEX %s ON %s", $mf1965['index_name'], $mf1965['table_name'] ); $i4f12d[] = sprintf( "CREATE %s INDEX %s ON %s(%s(191))", $mf1965['non_unique']?'':'UNIQUE', $mf1965['index_name'], $mf1965['table_name'], $mf1965['column_name'] ); } return array ($ef78dd,$i4f12d); } function rb01c($e851f5){ global$_model,$_db; $k752cb=kd372(); foreach ($k752cb as $d8ce4b => $t9e366){ $k752cb[$d8ce4b]=SEARCH_EXTRA_PREFIX. $t9e366; } $c0b95a=array_merge( array_keys($_model), array_values($k752cb) ); $ef78dd=$i4f12d=null; foreach ($c0b95a as $yd2ffa){ if(Log::$ned2b5)__log('Migrate: Convert table '. $yd2ffa. ' to utf8mb4?'); $x4b43b=m07e3($yd2ffa,$e851f5); if ($x4b43b){ $id89e2=$x4b43b['Collation']; if(stripos($id89e2,'utf8mb4')!==0){ list ( $ef78dd, $i4f12d )=e2mig__queries_to_recreate_indexes_for_table_($e851f5.$yd2ffa); if ($ef78dd!==null){ if(Log::$ned2b5){ __log('Migrate: Drop indexes of table '. $yd2ffa); } foreach ($ef78dd as $teaf65){ u0738($teaf65); } } if(Log::$ned2b5){ __log('Migrate: Convert table '. $yd2ffa. ' to UTF8MB4'); } u0738( "ALTER TABLE `". $e851f5.$yd2ffa ."` ". "CONVERT TO CHARACTER SET utf8mb4" ); if ($i4f12d!==null){ if(Log::$ned2b5){ __log('Migrate: Recreate indexes of table '.$yd2ffa); } foreach ($i4f12d as $e2464f){ u0738($e2464f); } } } } } } function e2s_migrate(){ cbb8d(); die ('Database migration finished.'); } function e2s_update_perform(){ global$_model,$settings,$_config,$_diagnose; $c7123a=n2ac5(); $dd98a0=max((int) ($c7123a['version']), 2285); if ($c7123a['version']==E2_VERSION){ j4930(); die; } if($_config['log_updates']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('update-$'); } if(Log::$ned2b5)__log('Update from v'. $dd98a0 .' to v'. E2_VERSION.' {'); if ($dd98a0 < 2587){ jc5a6('caches/*'); rmdir('caches'); } if ($dd98a0 < 2691){ $settings=e2_utf8_version_of_array_($settings); if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { q8a40($_strings['er--cannot-save-data'],E2E_PERMISSIONS_ERROR); k4006(); } } if ($dd98a0 < 2921){ $settings['template']='plain'; } if ($dd98a0 < 3223){ $settings['v3223_rss_permalinks_before_stamp']=time(); } if ($dd98a0 < 3354){ @rename('pictures/userpics/',AVATARS_FOLDER); @unlink(USER_FOLDER. 'password-reset.txt'); } if ($dd98a0 < 3496){ $settings['appearance']['respond_to_dark_mode']=true; } @unlink(USER_FOLDER. 'last-update.psa'); @unlink(CACHES_FOLDER.'index.xml'); @eaf42(CACHES_FOLDER); @eaf42(BACKUP_FOLDER); @eaf42(MEDIA_ROOT_FOLDER.PICTURES_FOLDER .'remote/'); @eaf42(MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER .'remote/'); if (@$settings['template']=='')$settings['template']=DEFAULT_TEMPLATE; if (isset ($settings['appearance']['hot_frontpage'])) { unset($settings['appearance']['hot_frontpage']); } if (isset ($settings['db']['table_prefix'])) { if($settings['db']['table_prefix'] != @$_config['db_table_prefix']) { die ('Youve been using a database with a table prefix '. $settings['db']['table_prefix'] .'. Now this should be set in the configuration. Please add the following line to the file user/config.php:<br /><br />$_config[\'db_table_prefix\'] = \''. $settings['db']['table_prefix'] .'\';<br /><br />Then refresh this page.'); } else { unset($settings['db']['table_prefix']); } } if (isset ($settings['comments']['on'])) { if (!$settings['comments']['on']) { try { u0738( "UPDATE LOW_PRIORITY `". $_config['db_table_prefix']."Notes` ". "SET `IsCommentable`=0 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ); } catch (AeMySQLException $e){} } $settings['comments']['default_on'] = (bool)$settings['comments']['on']; unset($settings['comments']['on']); } if ( is_file(USER_FOLDER.'settings.json') and is_file(USER_FOLDER.'settings.psa') ) { @unlink(USER_FOLDER.'settings.psa'); } if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { q8a40($_strings['er--cannot-save-data'],E2E_PERMISSIONS_ERROR); } e2_drop_all_kinds_of_cache(); cbb8d(); if ($dd98a0 < 3386){ if (ha521()) { $fddece=a476c(); try { $fddece -> erase(); } catch (\S2\Rose\Exception\RuntimeException $e){ if(Log::$ned2b5)__log('Rose not available'); } } c198f(); } $_diagnose['need?']=true; ic64a('diagnose','1'); $c7123a=s5be8(E2_VERSION); if(Log::$ned2b5)__log('}'); if (we852()) { q8a40(e2l_get_string('gs--updated-successfully', array ( 'from' => 'v'. $dd98a0, 'to' => 'v'. $c7123a['version'], )), E2E_MESSAGE); } e2_go_to(); die; } define('E2_MYSQL_CONNECT_TIMEOUT',5); function q985b($mfa48c='',$d78940=null){ static $u060d3=false; global$settings,$_db,$k11755,$_config; if ($u060d3) return; if ($d78940===null)$d78940=$settings['db']; $kd51e8=mysqli_init(); $kd51e8 -> options(MYSQLI_OPT_CONNECT_TIMEOUT,E2_MYSQL_CONNECT_TIMEOUT); if($_config['dev_chaos'] and !rand(0, (1/$_config['dev_chaos']) - 1)) { throw new AeMySQLCannotConnectException('Could not '. $mfa48c ."\n\nChaos in e2_mysql_ensure"); } $x06aa6=@mysqli_real_connect( $kd51e8, 'p:'. $d78940['server'], $d78940['user_name'], iee85($d78940['passw']) ); if (!$x06aa6){ $u70106=mysqli_connect_errno(); if ($u70106==1045){ $x06aa6=@mysqli_real_connect( $kd51e8, 'p:'. $d78940['server'], $d78940['user_name'], $d78940['passw'] ); if ($x06aa6){ $d78940['passw']=n1305($d78940['passw']); $settings['db']=$d78940; if(Log::$ned2b5)__log('Storing encrypted password'); @k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE)); } else { throw new AeMySQLAccessDeniedException('Could not '. $mfa48c); } } else { throw new AeMySQLCannotConnectException('Could not '. $mfa48c); } } $_db['version']=mysqli_get_server_info($kd51e8); if(version_compare($_db['version'],E2_MINIMUM_MYSQL,'<')) { throw new AeMySQLTooOldException('Could not '. $mfa48c); } if (!@mysqli_select_db($kd51e8,$d78940['name'])) { throw new AeMySQLNotFoundException('Could not '. $mfa48c); } $_db['link']=$kd51e8; $_db['charset']=version_compare($_db['version'],'5.5.3','>=')?'utf8mb4':'utf8'; $b1b1cc='SET NAMES '. $_db['charset']; mysqli_query($kd51e8,$b1b1cc); @$k11755 ++; if(Log::$ned2b5)__log('DB ['. $k11755 .']: '. $b1b1cc); $u060d3=true; } function u0738($b1b1cc,$mfa48c='run some query'){ global $k11755,$_db,$_strings,$_config; q985b($mfa48c); if($_config['dev_chaos'] and !rand(0, (1/$_config['dev_chaos']) - 1)) { throw new AeMySQLQueryException('Could not '. $mfa48c ."\n\nChaos in e2_mysql_query"); } @$k11755 ++; if(Log::$ned2b5) if ($mfa48c)__log('Will '. $mfa48c); if(Log::$ned2b5)__log('DB ['. $k11755 .']: '. $b1b1cc); $_db['result'] = @mysqli_query($_db['link'],$b1b1cc); if (!$_db['result']) { throw new AeMySQLQueryException('Could not '. $mfa48c ."\n\nMySQL says:\n". mysqli_error($_db['link'])); } } function d0d6b($type=MYSQLI_ASSOC){ global$_db; $r2cb9d=array(); while ($h0cc17=@mysqli_fetch_array($_db['result'],$type)) { foreach ($h0cc17 as $f865c0 => $j4921c){ if(is_string($j4921c)) { $h0cc17[$f865c0]=$j4921c; } } $r2cb9d[] = $h0cc17; } return $r2cb9d; } function a7928($fb45cf){ global$_db; q985b('escape string'); return mysqli_real_escape_string($_db['link'],$fb45cf); } function lb488(){ echo '<pre>'; echo 'Sifting backups...<br>'; $d10ae9=array(); foreach(glob(BACKUP_FOLDER. '*.sql') as $d8c7dd){ if(preg_match('/^backup\-(\d+)\-(\d+)\-(\d+)\-at\-(\d+)\-(\d+)\-(\d+)\.sql$/is',basename($d8c7dd),$j9c28d)) { list (, $q41529,$t6f8f5,$r8277e,$o2510c,$f865c0,$z03c7c)=$j9c28d; $k96b8c=gmmktime($o2510c,$f865c0,$z03c7c,$t6f8f5,$r8277e,$q41529); $d10ae9[$k96b8c]=$d8c7dd; } } if(count($d10ae9) > 3){ echo 'More than 3 backups, time to sift...<br>'; $i536a1=-1; $mf46c9=array (SECONDS_IN_A_MINUTE,SECONDS_IN_AN_HOUR,SECONDS_IN_A_DAY, -1); $f865c0=0; foreach(array_reverse($d10ae9,true) as $k96b8c => $d8c7dd){ echo '-> '. $d8c7dd .' ('. gmdate('r',$k96b8c) .')<br>'; if ($i536a1 == -1){ echo '   latest, leave<br>'; $i536a1=$k96b8c; } elseif ($mf46c9[$f865c0] == -1){ echo '   too old, remove<br>'; unlink($d8c7dd); } else { if ($i536a1-$k96b8c < $mf46c9[$f865c0]) { echo '   no need (not long ago), remove<br>'; unlink($d8c7dd); } else { $f865c0 ++; echo '   ok, leave, set interval to '. $mf46c9[$f865c0] .'<br>'; $i536a1=$k96b8c; } } } } else { echo 'No need to sift<br>'; } echo '</pre>'; return; } function e2s_dump(){ global$_model,$_db,$_config; try { q985b('make backup'); if($_db['link']) { $m68720=time() - (SECONDS_IN_A_DAY); $u9ab2e=array(); foreach(array_keys($_model) as $oaab9e){ $u9ab2e[] = $_config['db_table_prefix'].$oaab9e; } $g07cc6=time(); $j435ed=BACKUP_FOLDER .'backup-'.gmdate('Y-m-d-\a\t-H-i-s',$g07cc6).'.sql'; e2_backup( $_db['link'], $u9ab2e, $j435ed ); lb488(); die ('Backed up.'); } } catch (AeMySQLException $e){ b12f6($e,'Could not do backup'); die ('Could not do backup.'); } } define('ALIAS_MAX_LENGTH',64); function e2ali__alias_from_title_($h36cd3){ global$_config; $p3e891=$h36cd3; if(array_key_exists('autoreplace_for_aliases',$_config)) { $p3e891=strtr( $p3e891, $_config['autoreplace_for_aliases'] ); } $p3e891=l2183($p3e891); $p3e891=str_replace('\'','',$p3e891); $p3e891=str_replace('','',$p3e891); $p3e891=str_replace(chr(146),'',$p3e891); $v17901=''; for ($f865c0=0; $f865c0 < strlen($p3e891); ++ $f865c0){ if ( (ord($p3e891[$f865c0]) >= 48 and ord($p3e891[$f865c0]) <= 57) or (ord($p3e891[$f865c0]) >= 65 and ord($p3e891[$f865c0]) <= 90) or (ord($p3e891[$f865c0]) >= 97 and ord($p3e891[$f865c0]) <= 122) or 0 ){ $v17901.=$p3e891[$f865c0]; } else { $v17901.='-'; } } $v17901=preg_replace('/\-+/','-',$v17901); $v17901=trim($v17901,'-'); $v17901=strtolower($v17901); if ($v17901=='-')$v17901=''; $v17901=substr($v17901,0,ALIAS_MAX_LENGTH); return $v17901; } function e2_aliasrec_of_alias_($k72487){ global$_config; if ((string)$k72487==='') return false; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Aliases` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `Alias` = '". $k72487 ."' ". "ORDER BY `Stamp` LIMIT 1", 'get database record for alias "'. $k72487 .'"' ); $result=d0d6b(); if(count($result)==1){ return$result[0]; } else { return false; } } function e2_active_alias_for_page_($l89111,$rdffc4){ global$_config,$_e2_active_aliases; if ($rdffc4){ if ( is_array($_e2_active_aliases) and array_key_exists($l89111.$rdffc4,$_e2_active_aliases) ) { if(Log::$ned2b5)__log( 'Aliases: alias of entity "'. $l89111 .'" id "'. $rdffc4 .'" '. 'is livecached as "'. @$_e2_active_aliases[$l89111.$rdffc4] .'"' ); return @$_e2_active_aliases[$l89111.$rdffc4]; } else { u0738( "SELECT `Alias` ". "FROM `". $_config['db_table_prefix']."Aliases` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `EntityType` = '". $l89111 ."' ". "AND `EntityID` = ". $rdffc4 ." ". "ORDER BY `Stamp` DESC LIMIT 1", 'get alias record for entity "'. $l89111 .'" id '. $rdffc4.' to detect active alias' ); $result=d0d6b(); $k72487=$result[0]['Alias']; if (!$k72487 and $l89111==ENTITY_TYPE_TAG){ u0738( "SELECT OriginalAlias ". "FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". ((int)$rdffc4)."'", 'get orginial alias for tag id '. $rdffc4.' to detect active alias' ); $result=d0d6b(); $k72487=$result[0]['OriginalAlias']; } $_e2_active_aliases[$l89111.$rdffc4]=$k72487; } if(Log::$ned2b5)__log('Got alias "'. @$_e2_active_aliases[$l89111.$rdffc4] .'"'); return @$_e2_active_aliases[$l89111.$rdffc4]; } } function od712($y15d61,$l89111,$rdffc4,$h36cd3,$bfb873=1){ global$_e2_active_aliases; if(Log::$ned2b5)__log('Aliases: "'. $y15d61 .'" available alias for source "'. $h36cd3. '"'); if ($y15d61=='set' and (!$l89111 or !$rdffc4)) return false; $v17901=e2ali__alias_from_title_($h36cd3); if ($h36cd3!=='' and $v17901===''){ $v17901=(string)$bfb873; } elseif ($bfb873 > 1){ $o9f626='-'. $bfb873; $v17901=substr($v17901,0,ALIAS_MAX_LENGTH-strlen($o9f626)) . $o9f626; } if ($uc45dd=e2_aliasrec_of_alias_($v17901)) { $d6bae4=$uc45dd['EntityType']; $u1123c=$uc45dd['EntityID']; if ( (($rdffc4 and $u1123c==$rdffc4) and ($l89111 and $d6bae4==$l89111)) or $v17901!=e2_active_alias_for_page_($d6bae4,$u1123c) ) { if ($y15d61=='find'){ return $v17901; } if ($y15d61=='set'){ if(Log::$ned2b5)__log('Aliases: update alias timestamp'); qaa79('Aliases', array ( 'ID' => $uc45dd['ID'], 'EntityType' => $l89111, 'EntityID' => $rdffc4, 'Alias' => $v17901, 'Stamp' => time(), )); return$_e2_active_aliases[$l89111.$rdffc4]=$v17901; } } else { return od712($y15d61,$l89111,$rdffc4,$h36cd3,$bfb873+1); } } else { if ($l89111 and $rdffc4 and $v17901==''){ if(e2_active_alias_for_page_($l89111,$rdffc4)==''){ return ''; } } if(Log::$ned2b5)__log('Aliases: its an empty alias, and it was not being used for this entity'); if ( $l89111==ENTITY_TYPE_TAG and $dd62e3=c8770($v17901) ) { if ($dd62e3['ID']!=$rdffc4){ return od712($y15d61,$l89111,$rdffc4,$h36cd3,$bfb873+1); } } if ($y15d61=='find'){ return $v17901; } if ($y15d61=='set'){ v9943('Aliases', array ( 'EntityType' => $l89111, 'EntityID' => $rdffc4, 'Alias' => $v17901, 'Stamp' => time(), )); return$_e2_active_aliases[$l89111.$rdffc4]=$v17901; } } return ''; } function e2m_note($parameters=array ()) { global $settings, $x57de2, $_config, $_superconfig, $_strings; if(Log::$ned2b5)__log('Note {'); $saad65=$parameters['*note']; if ($saad65==false){ return e2_error404_mode(); } if (!yb44b($saad65,we852())) { return e2_error404_mode(); } $gd58c0=x83c8('e2m_note',$parameters); if(Log::$ned2b5)__log('Navigation {'); $ifcb08=mcca7($saad65,'prev'); $ed0cab=mcca7($saad65,'next'); if ($ifcb08){ $db3b32['prev-href']=x83c8('e2m_note', array ('*note' => $ifcb08)); $db3b32['prev-title']=u6f10(htmlspecialchars($ifcb08['Title'],ENT_NOQUOTES,HSC_ENC)); } if ($ed0cab){ $db3b32['next-href']=x83c8('e2m_note', array ('*note' => $ed0cab)); $db3b32['next-title']=u6f10(htmlspecialchars($ed0cab['Title'],ENT_NOQUOTES,HSC_ENC)); } $db3b32['title']=$_strings['nm--posts']; $db3b32['timeline?']=false; $db3b32['this-title']=u6f10(htmlspecialchars($saad65['Title'],ENT_NOQUOTES,HSC_ENC)); if(Log::$ned2b5)__log('}'); if(Log::$ned2b5)__log('Packaging...'); $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_ord']=0; $saad65['_']['_ord_max']=0; $q8e4cd=o6791($saad65); $ye35b1=''; $s33ff2=false; $g905f7=false; $s7bae4=array(); $ud09b4=''; if (we852()) { $l83625=e2_note_cache_filename_with_id_($saad65['_']['_id'] .'-comments-author'); } else { $l83625=e2_note_cache_filename_with_id_($saad65['_']['_id'] .'-comments'); } $u1e8cc=null; if(CACHE_NOTES_COMMENTS and is_file($l83625)) { $u1e8cc=@unserialize(file_get_contents($l83625)); } if(Log::$ned2b5)__log('Comments {'); if(is_array($u1e8cc)) { if(Log::$ned2b5)__log('retrieve cached ctree'); $ye35b1=$u1e8cc; } else { if(Log::$ned2b5)__log('assemble ctree...'); $xc1fdc=n70a7($saad65['ID']); $na5d49=array(); $s04c25=true; foreach ($xc1fdc as $d8ce4b => $l4032b){ if ($l4032b['IsVisible']) { $l4032b['_']['_id']=$l4032b['ID']; $l4032b['_']['_ord']=$d8ce4b; $l4032b['_']['_ord_max']=count($xc1fdc)-1; $z06d4c=f86f8( $saad65, $l4032b, $d8ce4b+1 ); if ($z06d4c['new?'] and $s04c25){ $z06d4c['first-new?']=true; $s04c25=false; } $na5d49[] = $z06d4c; } } $ye35b1=$na5d49; if(CACHE_NOTES_COMMENTS)k6e52($l83625,serialize($ye35b1)); } if(Log::$ned2b5)__log('} // Comments'); if (!@$_config['read_only'] and $q8e4cd['commentable-now?']) { $b80f02=f66aa($saad65); $b80f02['.comment-number']=count($ye35b1)+1; } if (we852() and gb387($saad65,NOTE_COMMENTABLE_NOW_CONDITIONALLY)) { if ($saad65['IsCommentable']) { $s7bae4['href']=x83c8('e2m_note_flag', array ( '*note' => $saad65, 'flag' => 'IsCommentable', 'value' => 0, )); $s7bae4['text']=$_strings['bt--close-comments-to-post']; } else { $s7bae4['href']=x83c8('e2m_note_flag', array ( '*note' => $saad65, 'flag' => 'IsCommentable', 'value' => 1, )); $s7bae4['text']=$_strings['bt--open-comments-to-post']; } } if ( we852() and array_key_exists('new-comments-count',$q8e4cd) and $q8e4cd['new-comments-count'] ) { if(Log::$ned2b5)__log('mark comments as not new'); e2_drop_caches_for_note_($y21158); qaa79('Comments', array ('IsNew' => 0), array ('NoteID' => $saad65['_']['_id'])); } if(Log::$ned2b5)__log('more work...'); $we70c4['title']=$saad65['Title']; $we70c4['pages']=$db3b32; $we70c4['summary']=$q8e4cd['summary']; $we70c4['notes'] = array ('only' => $q8e4cd); if ($ye35b1) $we70c4['comments']['each']=$ye35b1; if ($s7bae4) $we70c4['comments']['toggle']=$s7bae4; $we70c4['comments']['count']=$q8e4cd['comments-count']; $we70c4['comments']['count-text']=$q8e4cd['comments-count-text']; $we70c4['comments']['new-count']=$q8e4cd['new-comments-count']; $we70c4['comments']['new-count-text']=$q8e4cd['new-comments-count-text']; $we70c4['comments']['commentable-now?']=$q8e4cd['commentable-now?']; if ($b80f02){ $we70c4['form-comment']=$b80f02; } if(Log::$ned2b5)__log('} // Note'); return $we70c4; } function e2m_note_read($parameters=array ()) { if(Log::$ned2b5)__log('Note read {'); $saad65=$parameters['*note']; $zff089=time(); $zff089=$zff089 - ($zff089 % SECONDS_IN_AN_HOUR); v9943( 'Actions', array ( 'EntityID' => $saad65['ID'], 'Stamp' => $zff089, 'ReadCount' => 1, ), 'INSERT LOW_PRIORITY', 'ON DUPLICATE KEY UPDATE `ReadCount` = `ReadCount` + 1' ); if(Log::$ned2b5)__log('}'); e2_go_to(x83c8('e2m_note',$parameters)); } function e2m_note_withdraw($parameters=array ()) { global$_strings; $oea59a=$parameters['*note']; if (!$oea59a) return e2_error404_mode(); if($_SERVER['REQUEST_METHOD']!='POST'){ return e2_go_to(x83c8('e2m_note', array ('*note' => $oea59a))); } $q22db1=x83c8('e2m_note_broadcast', array ('*note' => $oea59a)); $oea59a['IsPublished']=0; $oea59a['IsCommentable']=0; $oea59a['IsVisible']=1; $oea59a['Stamp']=time(); $oea59a['IP']=p1668(); if($parameters['alias']) { $oea59a['OriginalAlias']=$parameters['alias']; } else { $oea59a['OriginalAlias']=od712( 'find',ENTITY_TYPE_NOTE,$oea59a['ID'],$oea59a['Title'] ); } e2_drop_caches_for_note_($oea59a['ID']); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); if ($oea59a['IsFavourite']) { @unlink(CACHE_FILENAME_FAVS); } qaa79('Notes',$oea59a); s10fe($oea59a['ID']); gcc38($q22db1); od712('set',ENTITY_TYPE_NOTE,$oea59a['ID'],''); e2_go_to(x83c8('e2m_draft', array ( '*note' => $oea59a, ))); } function e2m_note_delete($parameters=array()) { global$_strings; $oea59a=$parameters['*note']; if (!$oea59a) return e2_error404_mode(); $vf91b2=!$oea59a['IsPublished']; if ($vf91b2){ $e72bd7=e2l_get_string('gs--draft-will-be-deleted', array ( 'draft' => htmlspecialchars($oea59a['Title'],ENT_NOQUOTES,HSC_ENC), )); } else { $e72bd7=e2l_get_string('gs--post-will-be-deleted', array ( 'post' => htmlspecialchars($oea59a['Title'],ENT_NOQUOTES,HSC_ENC), )); } $ld5d3d=$vf91b2? $_strings['pt--draft-deletion']:$_strings['pt--post-deletion']; $v57529=array ( '.note-id' => $oea59a['ID'], '.is-draft' => (int)$vf91b2, 'note-title' => htmlspecialchars($oea59a['Title'],ENT_COMPAT,HSC_ENC), 'caution-text' => $e72bd7, 'form-action' => x83c8('e2s_note_delete'), 'submit-text' => $_strings['fb--delete'], 'draft?' => (int)$vf91b2, ); if ($oea59a['IsPublished']) { $v57529['withdraw-href']=x83c8( 'e2m_note_withdraw',$parameters ); } $r2cb9d=array ( 'title' => $ld5d3d. ': '. htmlspecialchars($oea59a['Title'],ENT_NOQUOTES,HSC_ENC), 'heading' => $ld5d3d, 'form' => 'form-note-delete', 'form-note-delete' => $v57529, ); return $r2cb9d; } function e2m_note_flag_favourite($parameters){ global$_config; $parameters['flag']='IsFavourite'; r705b([ 'flag-name' => 'favourite', 'candy-name' => 'e2m_note_flag_favourite', 'parameters' => $parameters, 'flipping-function' => function () use ($parameters){ l7e6c($parameters); }, ]); } function e2m_note_flag($parameters){ l7e6c($parameters); if(array_key_exists('draft',$parameters)) { e2_go_to(x83c8('e2m_draft',$parameters)); } else { e2_go_to(x83c8('e2m_note',$parameters)); } die; } function l7e6c($parameters){ $y21158=$parameters['*note']['ID']; if (!is_numeric($y21158)) { return e2_error404_mode(); } e2_drop_caches_for_note_($y21158); if($parameters['flag']=='IsFavourite'){ @unlink(CACHE_FILENAME_FAVS); } if($parameters['flag']=='IsVisible'){ i7996(); } qaa79('Notes', array ( 'ID' => $y21158, $parameters['flag'] => (int) ($parameters['value']==1), )); try { $w39a37=i4627($y21158); b5b68($w39a37); } catch (AeMySQLException $e){ b12f6($e,'Could not broadcast note flag change'); } return true; } function e2m_note_use_formatter($parameters){ $y21158=$parameters['*note']['ID']; if (!is_numeric($y21158)) { return e2_error404_mode(); } e2_drop_caches_for_note_($y21158); if (!$parameters['*note']['IsPublished']) { @unlink(CACHE_FILENAME_DRAFTS); } if(in_array($parameters['formatter'], array ('calliope','raw','neasden'))) { qaa79('Notes', array ( 'ID' => $y21158, 'FormatterID' => $parameters['formatter'], )); echo 'formatter set to '. $parameters['formatter']; } else { echo 'unknown formatter'; } die; } function w7dd3($p60cd8,$parameters=array ()) { global$full_blog_url,$_strings,$_config; $ld5d3d=$_strings['pt--new-post']; $cf74f5=$_strings['pt--new-post']; $y21158='new'; $j9763c=$_config['default_formatter']; if ($p60cd8=='edit'){ $oea59a=$parameters['*note']; if (!$oea59a) return e2_error404_mode(); if ($oea59a){ if ($oea59a['IsPublished']) { $cf74f5=$_strings['pt--edit-post']; $z3aa13=''; $k72487=$parameters['alias']; } else { $cf74f5=$_strings['pt--edit-draft']; $z3aa13=od712( 'find',ENTITY_TYPE_NOTE,$oea59a['ID'],$oea59a['Title'] ); if (@$oea59a['OriginalAlias']) { $k72487=$oea59a['OriginalAlias']; } else { $k72487=$z3aa13; } } } $y21158=$oea59a['ID']; $j9763c=$oea59a['FormatterID']; $ld5d3d=$oea59a['Title']; } $q04868=ubb5b(); $f77b75=array(); if ($q04868!==null) foreach ($q04868 as $qd7df5){ $f77b75[] = $qd7df5['tag']; } $cd2e3e=array(); if ($p60cd8=='edit' and count($f77b75)) { $q04868=ace23($oea59a['ID']); foreach ($q04868 as $qd7df5){ $cd2e3e[] = htmlspecialchars($qd7df5['Keyword'],ENT_NOQUOTES,HSC_ENC); } } $kc93df=array(); foreach ($f77b75 as $qd7df5){ $lfd2ef['name']=$qd7df5; $lfd2ef['selected?']=in_array($qd7df5,$cd2e3e); $kc93df[] = $lfd2ef; } $z9dbb8=''; $cd2e3e=implode(', ',$cd2e3e); if ($cd2e3e)$z9dbb8=$cd2e3e; if ($p60cd8=='write'){ $sc50d0=$_strings['fb--save-and-preview']; } if ($p60cd8=='edit'){ if(array_key_exists('draft',$parameters)) { $sc50d0=$_strings['fb--save-and-preview']; } else { $sc50d0=$_strings['fb--save-changes']; } } $se449c=array(); if ($p60cd8=='edit'){ $se449c=rc0c4( $oea59a['FormatterID'],$oea59a['Text'],'full' ); } $t75e1b=hf898( 'note',$y21158,$se449c ); if ($p60cd8=='edit'){ t2f83( 'Notes', $oea59a, $se449c ); } $k96b8c=min($oea59a['Stamp'],time()); $hc999b=yd10e(); $f85faf=x1363($hc999b); $r2cb9d['title']=$ld5d3d; $r2cb9d['heading']=$cf74f5; $r2cb9d['form']='form-note'; $r2cb9d['uploads'] = [ 'enabled?' => $f85faf, 'each' => $t75e1b, 'upload-action' => x83c8('e2j_file_upload'), 'remove-action' => x83c8('e2j_file_remove'), ]; $r2cb9d['form-note'] = array ( '.note-id' => $y21158, '.formatter-id' => $j9763c, '.from' => substr($_SERVER['HTTP_REFERER'],strlen($full_blog_url)+1), '.old-tags-hash' => md5($z9dbb8), '.action' => $p60cd8, 'form-action' => x83c8('e2s_note_process'), 'form-note-livesave-action' => x83c8('e2j_note_livesave'), 'create:edit?' => (bool) ($p60cd8=='write'), 'title' => htmlspecialchars($oea59a['Title'],ENT_COMPAT,HSC_ENC), 'tags' => $z9dbb8, 'tags-info' => $kc93df, 'text' => htmlspecialchars($oea59a['Text'],ENT_NOQUOTES,HSC_ENC), 'all-tags' => $f77b75, 'stamp-formatted' => h5a2f('d.m.Y H:i:s',$k96b8c,l0923($oea59a)), 'time' => $oea59a['IsPublished']? array ((int)$k96b8c,l0923($oea59a)) : false, 'alias-autogenerated' => $z3aa13, 'uploads-enabled?' => $f85faf, 'alias' => $k72487, 'submit-text' => $sc50d0, 'space-usage' => zaf64($hc999b), ); if ($p60cd8=='edit'){ $r2cb9d['related-delete-href']=x83c8( 'e2m_note_delete', array ('*note' => $oea59a) ); if (!array_key_exists('draft',$parameters)) { $oea59a['_']['_id']=$oea59a['ID']; $oea59a['_']['_ord']=0; $oea59a['_']['_ord_max']=0; $r2cb9d['form-note']['note']=o6791($oea59a); } } return $r2cb9d; } function e2m_note_edit($parameters=array ()) { return w7dd3('edit',$parameters); } function e2m_write(){ return w7dd3('write'); } function e2s_note_process(){ global$_fp_error,$_strings; $y21158=na21e(); if (!$y21158){ if($_fp_error==FP_TITLE_OR_TEXT_EMPTY){ q8a40($_strings['er--post-must-have-title-and-text'],E2E_USER_ERROR); } elseif($_fp_error==FP_NO_ID_OR_NEW){ } else { q8a40($_strings['er--error-occurred']); } e2_go_to(x83c8('e2m_write')); die; } try { $saad65=i4627($y21158); if ($saad65['IsPublished']) { e2_go_to(x83c8('e2m_note', array ('*note' => $saad65))); } else { e2_go_to(x83c8('e2m_draft', array ('*note' => $saad65))); } } catch (AeMySQLException $e){ b12f6($e,'Could not get note by ID'); e2_go_to(); } die; } function e2s_note_publish(){ global$_strings,$_config,$settings; $y21158=false; if(array_key_exists('note-id',$_POST)) { $y21158=$_POST['note-id']; $iaddfe=false; $oea59a=i4627($y21158); $i82b30=$oea59a['OriginalAlias']; $p098ae=$oea59a['Stamp']; $xbb4fe=!$oea59a['IsExternal']; $oea59a['ID']=$y21158; $oea59a['IsVisible']=1; $oea59a['IsPublished']=1; $oea59a['IsCommentable'] = (int)$settings['comments']['default_on']; $oea59a['IsFavourite']=0; if(array_key_exists('browser-offset',$_POST)) { $mb2c6c=ja618(@$_POST['browser-offset']); } else { $mb2c6c=g5c05(); } if ($iaddfe and $k96b8c=d1630($iaddfe,$mb2c6c)) { $oea59a['Stamp']=$k96b8c; } elseif ($xbb4fe){ $oea59a['Stamp']=time(); } else { $oea59a['Stamp']=$p098ae; } if (vd2e1($oea59a)) { $oea59a['IsIndexed']='1'; } if ($mb2c6c){ $oea59a['Offset'] = (int)$mb2c6c['offset']; $oea59a['IsDST'] = (int)$mb2c6c['is_dst']; } e2_drop_caches_for_note_($y21158); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); qaa79('Notes',$oea59a); $k72487=''; if ($i82b30 or $i82b30==='0'){ $k72487=od712('set',ENTITY_TYPE_NOTE,$y21158,$i82b30); $oea59a['OriginalAlias']=$k72487; } if ($k72487!=$i82b30){ qaa79('Notes',$oea59a); } if (yb44b($oea59a)) { b5b68($oea59a); } e2_go_to(x83c8('e2m_note', array ('*note' => $oea59a))); die; } e2_go_to(); die; } function le268($y21158,$l9a92d=-1){ global$_config; e2_drop_caches_for_note_($y21158); if ($l9a92d or $l9a92d === -1){ @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); } if (!$l9a92d or $l9a92d === -1) { @unlink(CACHE_FILENAME_FAVS); } u0738( "DELETE FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". ((int)$y21158) ."'", 'delete note by ID' ); s10fe($y21158); u0738( "DELETE FROM `". $_config['db_table_prefix']."Aliases` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `EntityID`=". ((int)$y21158), 'delete aliases after deleting note' ); u0738( "DELETE FROM `". $_config['db_table_prefix']."NotesKeywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". ((int)$y21158), 'delete tag bindings after deleting note' ); } function e2s_note_delete(){ global$_strings,$_config; $y21158=$_POST['note-id']; $l9a92d=(bool)$_POST['is-draft']; $oea59a=i4627($y21158); $q22db1=x83c8('e2m_note_broadcast', array ('*note' => $oea59a)); le268($y21158,$l9a92d); gcc38($q22db1); if ($l9a92d){ e2_go_to(x83c8('e2m_drafts')); } else { e2_go_to(); } die; } function e2j_note_livesave(){ die (na21e('ajaxresult')); } function o6791($saad65,$r8698e=false){ global $settings, $_config, $_superconfig, $_candy, $_current_tag, $x57de2, $ee5564, $full_blog_url; if (!is_numeric($saad65['_']['_id'])) return false; $bda497=e2_note_cache_filename_with_id_($saad65['_']['_id']); $ke244c=null; if(CACHE_NOTES and is_file($bda497)) { $ke244c=@unserialize(file_get_contents($bda497)); } if(Log::$ned2b5)__log('Notes: package note <'. $saad65['_']['_id'] .'>...'); $ee919a=v7f78(); if(CACHE_NOTES and is_array($ke244c)) { if(Log::$ned2b5)__log('Notes: retrieve cached ctree'); $vc6827=$ke244c; } else { if(Log::$ned2b5)__log('Notes: assemle cacheable ctree...'); if(Log::$ned2b5)__log('Notes: formatter ID = '. $saad65['FormatterID']); $o2bfe4=j154e($saad65['FormatterID'], @$saad65['Text'],'full'); $vc6827['title'] = u6f10(htmlspecialchars($saad65['Title'],ENT_NOQUOTES,HSC_ENC)); $vc6827['text'] = $o2bfe4['text-final']; $vc6827['summary'] = m5421($vc6827['text']); $vc6827['format-info'] = $o2bfe4['meta']; $vc6827['time'] = array ((int)$saad65['Stamp'],l0923($saad65)); $vc6827['last-modified'] = array ((int)$saad65['LastModified'],l0923($saad65)); $vc6827['last-ip'] = $saad65['IP']; $vc6827['published?'] = (bool)$saad65['IsPublished']; $vc6827['commentable?'] = (bool) ($saad65['IsCommentable'] && $saad65['IsPublished']); $vc6827['favourite?'] = (bool) ($saad65['IsFavourite'] && $saad65['IsPublished']); $vc6827['visible?'] = yb44b($saad65); $vc6827['scheduled?'] = false; $ad972d=@$saad65['SourceNoteData']; $ad972d=@json_decode($ad972d,true); $vc6827['source-main-image-url'] = @$ad972d['og_images'][0]; if(is_array($o2bfe4['meta']['resources-detected'])) { t6be4($o2bfe4['meta']['resources-detected']); } if (!$vc6827['published?'])$vc6827['time']=$vc6827['last-modified']; $vc6827['og-images']=tdbcc( 'note',$saad65['_']['_id'], $vc6827['format-info']['resources-detected'] ); $c0dff3=ace23($saad65['ID']); $hd57ac=array(); foreach ($c0dff3 as $f865c0 => $rb19ad){ $vc6827['og-images']=array_merge( $vc6827['og-images'], tdbcc('tag',$rb19ad['ID'], array ()) ); $le4d23['name']=htmlspecialchars($rb19ad['Keyword'],ENT_NOQUOTES,HSC_ENC); $le4d23['href']=x83c8('e2m_tag', array ('*tag' => $rb19ad)); $hd57ac[] = $le4d23; } $vc6827['tags']=$hd57ac; $g905f7=v254f($saad65['ID']); if ($vc6827['published?']) { $vc6827['comments-count']=$g905f7; } $ke244c=$vc6827; if(CACHE_NOTES) @k6e52($bda497,serialize($ke244c)); } if ($r8698e){ if(Log::$ned2b5)__log('Notes: short-track package for caching only'); if(Log::$ned2b5)__log('Notes: package note done in '. round(v7f78()-$ee919a,3)); return $vc6827; } if(Log::$ned2b5)__log('Notes: continue with the uncacheable, '. round(v7f78()-$ee919a,3) .' so far...'); $vc6827['commentable-now?']=gb387($saad65); if(array_key_exists('comments-count',$vc6827)) { $vc6827['comments-count-text']=e2l_get_string('gs--n-comments', array ( 'number' => $vc6827['comments-count'] )); } foreach ($vc6827['tags'] as $d8ce4b => $t9e366){ $vc6827['tags'][$d8ce4b]['current?'] = (bool) ($vc6827['tags'][$d8ce4b]['name']==$_current_tag); } $e2e88c=$saad65['IsPublished']?'e2m_note':'e2m_draft'; $vc6827['href']=x83c8($e2e88c, array ('*note' => $saad65)); if ($saad65['IsPublished']) { if ($saad65['OriginalAlias']) { $vc6827['href-original']=x83c8('e2m_note', array ('alias' => $saad65['OriginalAlias'])); } else { $l010d9=$saad65; $l010d9['__noalias!']=true; $vc6827['href-original']=x83c8('e2m_note', array ('*note' => $l010d9)); } } $vc6827=array_merge($vc6827,q1a48($saad65,true)); $vc6827['comments-link?'] = (bool) ( $saad65['IsPublished'] && (gb387($saad65) or ($vc6827['comments-count'] > 0)) && ('e2m_note'!=$_candy) ); if (we852()) { $mfe9e2=i3ce7($saad65['ID']); $vc6827['new-comments-count']=$mfe9e2; $vc6827['new-comments-count-text']=e2l_get_string('gs--comments-n-new', array ( 'number' => $mfe9e2 )); if ($saad65['IsPublished']) { if ($saad65['IsFavourite']) { $vc6827['favourite-toggle-href']=x83c8( 'e2m_note_flag_favourite', array ('*note' => $saad65,'value' => 0) ); } else { $vc6827['favourite-toggle-href']=x83c8( 'e2m_note_flag_favourite', array ('*note' => $saad65,'value' => 1) ); } } if (!@$_config['read_only']) { $vc6827['edit-href']=x83c8( 'e2m_note_edit', array ('*note' => $saad65) ); $d9920c=$vc6827['edit-href']; } } if($settings['appearance']['show_sharing_buttons']) { $deb769=$_config['share_to']; $k21bdd='|twitter|facebook|vkontakte|telegram|linkedin|whatsapp|'; if (@$_config['share_to_twitter_via']) { $s8d777['twitter']['via']=$_config['share_to_twitter_via']; } if(count($vc6827['og-images']) > 0){ $e62933=$vc6827['og-images'][0]; $k21bdd.='pinterest|'; $s8d777['pinterest']['media']=$e62933; } $vc6827['shareable?']=false; foreach(explode(',',$deb769) as $p5a9d3){ $p5a9d3=trim($p5a9d3); if(strstr($k21bdd,'|'. $p5a9d3. '|')) { $vc6827['shareable?']=true; $vc6827['share-to'][$p5a9d3]['share?']=true; if ($s8d777[$p5a9d3]) { $vc6827['share-to'][$p5a9d3]['data']=$s8d777[$p5a9d3]; } } } } if(array_key_exists('_',$saad65))$vc6827['_']=$saad65['_']; if(Log::$ned2b5)__log('Notes: package note done in '. round(v7f78()-$ee919a,3)); return $vc6827; } function i4627($xb80bb){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". $xb80bb ."'" ); $cfa816=d0d6b(); if(count($cfa816) > 0){ return $cfa816[0]; } else { return false; } } function mcca7($saad65,$lb4ca4,$p8f888=1){ global$_strings,$_config; $y7ffc4=($lb4ca4=='next')?'>':'<'; $m9b272=($lb4ca4=='next')?'':'DESC '; try { u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=". $p8f888 ." ". "AND `Stamp` ". $y7ffc4 ." '". $saad65['Stamp'] ."' ". w6f32(we852()). "ORDER BY STAMP ". $m9b272 . "LIMIT 1", 'get '. $lb4ca4 .' note' ); $cfa816=d0d6b(); if(count($cfa816) > 0) return $cfa816[0]; else return false; } catch (AeMySQLException $e){ b12f6($e,'Could not get '. $lb4ca4 .' note'); return null; } } function ua2d8($hddf82){ global$_config; if(Log::$ned2b5)__log('Lastmodifieds for Local Copier'); if(CACHE_LASTMODIFIEDS and is_file(CACHE_FILENAME_LASTMODIFIEDS)) { $s84636=@unserialize(file_get_contents(CACHE_FILENAME_LASTMODIFIEDS)); if ($s84636['ids_csv']==$hddf82){ if(Log::$ned2b5)__log('Returned from cache'); return $s84636['lastmodifieds_json']; } } $o56790='`ID`='. str_replace(',',' OR `ID`=',$hddf82); $eb7d96=array(); u0738( "SELECT `ID`, `LastModified` ". "FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (". $o56790 .")", 'get lastmodifieds for Local Copier' ); if(Log::$ned2b5)__log('Requested from DB'); $result=d0d6b(); foreach($result as $d8ce4b => $t9e366){ $eb7d96[(int)$t9e366['ID']] = (int)$t9e366['LastModified']; } $i08bb9=json_encode($eb7d96); if ($i08bb9=='[]')$i08bb9='{}'; $s84636=array ( 'ids_csv' => $hddf82, 'lastmodifieds_json' => $i08bb9, ); if(CACHE_LASTMODIFIEDS){ k6e52(CACHE_FILENAME_LASTMODIFIEDS,serialize($s84636)); } return $i08bb9; } function xd864($s8d777){ global$settings,$e71860,$_strings; $r7694f=$s8d777['query']; if (isset ($s8d777['page']) and $s8d777['page'] < 1) return e2_error404_mode(); $hd7e5d=$settings['appearance']['notes_per_page']; $db3b32=array(); $ifbb44=false; if (isset ($s8d777['page'])) { $e71860=$s8d777['page']; $r7694f.=' LIMIT '.($s8d777['page']-1)*$hd7e5d.', '.$hd7e5d; $p61e23=str_replace('SELECT *','SELECT count(*)',$s8d777['query']); u0738($p61e23,'count notes by criteria'); $result=d0d6b(); $ifbb44=$result[0]['count(*)']; $iae0fe=ceil($ifbb44/$hd7e5d); if ($e71860 > $iae0fe and $e71860!=1){ return e2_error404_mode(); } $db3b32['count']=$iae0fe; $db3b32['this']=$e71860; $db3b32['timeline?']=true; $db3b32['earlier-title']=$_strings['gs--earlier']; $db3b32['later-title']=$_strings['gs--later']; $o920fa=$s8d777['parameters']; if ($e71860 < $iae0fe){ $o920fa['page']=$e71860+1; $db3b32['earlier-href']=x83c8($s8d777['candy'],$o920fa); } if ($e71860 > 1){ $o920fa['page']=$e71860-1; $db3b32['later-href']=x83c8($s8d777['candy'],$o920fa); } } $z4358b=array(); u0738($r7694f,'get notes by criteria'); $result=$pe5b87=d0d6b(); if (@$s8d777['query-returns-only-ids']) { $result=array(); $o15514=we852(); foreach ($pe5b87 as $saad65){ $saad65=i4627($saad65['ID']); if ($saad65['IsPublished'] and yb44b($saad65,$o15514)) { $result[] = $saad65; } } } foreach($result as $d8ce4b => $saad65){ $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_ord']=$d8ce4b; $saad65['_']['_ord_max']=count($result)-1; $z4358b[] = o6791($saad65); } $l05a16=$z4358b; if (!isset ($s8d777['show-all-notes']) or @$s8d777['show-all-notes']!=true){ $l05a16=array_slice($z4358b,0,$hd7e5d); } if ($ifbb44===false)$ifbb44=count($l05a16); if (!count($z4358b) and array_key_exists('nothing',$s8d777)) { $r2cb9d['nothing']=$s8d777['nothing']; } $fcd0fd=array ( 'class', 'superheading', 'heading', 'title', 'search-related-tag', ); foreach ($fcd0fd as $af97bf){ if(array_key_exists($af97bf,$s8d777)) { $r2cb9d[$af97bf]=$s8d777[$af97bf]; } } if ($ifbb44){ $l5cde2=e2l_get_string( 'pt--n-posts', array ('number' => $ifbb44) ); } else { $l5cde2=$_strings['pt--no-posts']; } if(array_key_exists('maximum-notes',$s8d777) and $ifbb44 >= $s8d777['maximum-notes']) { $l5cde2=$_strings['gs--many-posts']; } foreach (array ('title','heading','superheading') as $e4b24c){ if(strstr($s8d777[$e4b24c],'%total%')) { $r2cb9d[$e4b24c]=str_replace('%total%', $l5cde2,$s8d777[$e4b24c]); } } $r2cb9d['notes']=$l05a16; $r2cb9d['pages']=$db3b32; return $r2cb9d; } function rf9fb($q41529,$t6f8f5,$r8277e=false){ global$_config; list ($b7b314,$wa1f20)=z5273($q41529,$t6f8f5,$r8277e); u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished` AND (`Stamp` BETWEEN " .$b7b314. " AND " .$wa1f20. ") ". "ORDER BY Stamp", 'get all notes for the date '. $r8277e .'.'. $t6f8f5 .'.'. $q41529 ); $result=d0d6b(); $ib1bc2=1; $r2cb9d=array(); foreach($result as $m65afd){ if(is_numeric($r8277e)) { $f3f917=((int)$q41529) .'/'. ((int)$t6f8f5) .'/'. ((int)$r8277e) == h5a2f('Y/n/j',$m65afd['Stamp'],l0923($m65afd)); } elseif(is_numeric($t6f8f5)) { $f3f917=((int)$q41529) .'/'. ((int)$t6f8f5) == h5a2f('Y/n',$m65afd['Stamp'],l0923($m65afd)); } else { $f3f917=((int)$q41529) == h5a2f('Y',$m65afd['Stamp'],l0923($m65afd)); } if ($f3f917){ if(is_numeric($r8277e)) { $m65afd['day_number']=$ib1bc2; } $r2cb9d[] = $m65afd; $ib1bc2 ++; } } return $r2cb9d; } function e2_published_noterec_with_parameters_($parameters=array ()) { $w39a37=e2_noterec_with_parameters_($parameters); if ($w39a37['IsPublished']) return $w39a37; } function e2_noterec_with_parameters_($parameters=array ()) { global$_config; $saad65=false; $nb5445=false; if ((string) @$parameters['oalias']!=='')$nb5445=$parameters['oalias']; if ((string)$nb5445!==''){ u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `OriginalAlias` = '". $nb5445 ."' ". "AND `IsPublished` = 0", 'get note record by original alias' ); $saad65=d0d6b(); if(count($saad65)==1) { $saad65=@$saad65[0]; if ($saad65) return $saad65; } } $d67e85=false; if (@$parameters['draft']!=='') $d67e85=$parameters['draft']; if (@$parameters['draft2']!=='')$d67e85=$parameters['draft2']; if ($d67e85){ $saad65=i4627($d67e85); return $saad65; } if ((string) @$parameters['alias']!==''){ if ($uc45dd=e2_aliasrec_of_alias_(@$parameters['alias'])) { if ($uc45dd['EntityType']==ENTITY_TYPE_NOTE){ $saad65=i4627($uc45dd['EntityID']); if ($saad65['IsPublished']) return $saad65; } } } $pc2d18=rf9fb($parameters['year'],$parameters['month'],$parameters['day']); if (@$pc2d18[$parameters['day-number']-1]) { return $pc2d18[$parameters['day-number']-1]; } } function qe56b($ld5d3d,$a1cb25,$mb2c6c,$hd19c2){ global$_config; le2f1(); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); $w39a37=array ( 'Title' => $ld5d3d, 'Text' => $a1cb25, 'FormatterID' => $_config['default_formatter'], 'OriginalAlias' => od712('find',ENTITY_TYPE_UNSPECIFIED,'',$ld5d3d), 'Uploads' => $hd19c2, 'Stamp' => (int)time(), 'LastModified' => (int)time(), ); if ($mb2c6c and is_array($mb2c6c)) { $w39a37['Offset'] = (int)$mb2c6c['offset']; $w39a37['IsDST'] = (int)$mb2c6c['is_dst']; } $w39a37=v9943('Notes',$w39a37); return $w39a37['ID']; } function d1630($rf2de2,$mb2c6c){ $hd17d3='/^ *(\d{1,2})\.(\d{1,2})\.(\d{2}|\d{4}) +(\d{1,2})\:(\d{1,2})\:(\d{1,2}) *$/'; if(preg_match($hd17d3,$rf2de2,$t6f8f5)) { $k96b8c=gmmktime($t6f8f5[4],$t6f8f5[5],$t6f8f5[6],$t6f8f5[2],$t6f8f5[1],$t6f8f5[3]); $k96b8c -= vb2bf($mb2c6c,$k96b8c); return $k96b8c; } else { return false; } } function na21e($z98ea6=''){ global$_fp_error,$_config,$_e2utf8__unformat_htmlentity_neasden,$_db; if(Log::$ned2b5)__log('Process note form'); try { $_fp_error=false; $y21158=$ld5d3d=$hd57ac=$a1cb25=$bb4960=''; if(array_key_exists('note-id',$_POST)) $y21158=$_POST['note-id']; if(array_key_exists('title',$_POST)) $ld5d3d=trim($_POST['title']); if(array_key_exists('tags',$_POST)) $hd57ac=$_POST['tags']; if(array_key_exists('text',$_POST)) $a1cb25=trim($_POST['text'],"\r\n"); if(array_key_exists('old-tags-hash',$_POST)) $bb4960=$_POST['old-tags-hash']; if(is_array($hd57ac))$hd57ac=implode(', ',$hd57ac); $hd57ac=trim($hd57ac); if ($y21158=='new'){ $_e2utf8__unformat_htmlentity_neasden=($_config['default_formatter']=='neasden'); } else { $_e2utf8__unformat_htmlentity_neasden=($_POST['formatter-id']=='neasden'); } $o73f92=m07e3('Notes'); if(stripos($o73f92['Collation'],'utf8mb4')!==0){ $ld5d3d=uff7c($ld5d3d); $hd57ac=uff7c($hd57ac); $a1cb25=uff7c($a1cb25,true); } $xffa71=$a1cb25; $xffa71=str_replace("\n",'\n'."\n",$xffa71); $xffa71=str_replace("\r",'\r'."\r",$xffa71); $xa6168=l163d(',',$hd57ac,'sort'); $hd57ac=implode(', ',$xa6168); $w65f31=md5($hd57ac); if(array_key_exists('browser-offset',$_POST)) { $mb2c6c=ja618(@$_POST['browser-offset']); } else { $mb2c6c=g5c05(); } $r02b37=@$_POST['old-stamp']; $iaddfe=@$_POST['stamp']; $k72487=@$_POST['alias']; if ($y21158!='new'){ $k383b7=i4627($y21158); } else { $k383b7=array(); } if ($y21158){ if ((string)$ld5d3d!=='' and (string)$a1cb25!==''){ if ($y21158=='new'){ $hd19c2=''; if(is_file(USER_FOLDER.'new-uploads.psa')) { $hd19c2=@file_get_contents(USER_FOLDER.'new-uploads.psa'); } try { $y21158=qe56b($ld5d3d,$a1cb25,$mb2c6c,$hd19c2); @unlink(USER_FOLDER.'new-uploads.psa'); $t33dd5='e2m_draft'; $q5ce5d=array ( '*note' => i4627($y21158), ); $w1fa03=[ 'success' => true, 'data' => [ 'status' => 'created', 'id' => $y21158, 'note-url' => x83c8($t33dd5,$q5ce5d), 'note-edit-url' => x83c8('e2m_note_edit',$q5ce5d) ] ]; $result=(int)$y21158; } catch (AeMySQLException $e){ b12f6($e,'Could not insert note'); $w1fa03=[ 'success' => false, 'error' => [ 'message' => 'Cannot create record' ] ]; $result=false; } } else { e2_drop_caches_for_note_($y21158); if (!$k383b7['IsPublished']) { @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); } $p71671=$k383b7; $p71671['ID']=$y21158; $p71671['Title']=$ld5d3d; $p71671['Text']=$a1cb25; $p71671['FormatterID']=$k383b7['FormatterID']; $p71671['LastModified']=time(); $p71671['IsIndexed']='1'; if ($r02b37!=$iaddfe){ if ($k96b8c=d1630($iaddfe,$mb2c6c)) { $p71671['Stamp']=min($k96b8c,time()); } else { unset ($k96b8c); } } $v17901=$k72487; if ((string)$k72487!==''){ $na7ff0=$k72487; } elseif (!$k383b7['IsPublished']) { $na7ff0=$ld5d3d; } else { $na7ff0=''; } if ($k383b7['IsPublished']) { $v17901=od712( 'set',ENTITY_TYPE_NOTE,$y21158,$na7ff0 ); $t33dd5='e2m_note'; $q5ce5d=array ( '*note' => $p71671, 'alias' => $v17901, ); } else { $x926c6=true; $v17901=od712('find',ENTITY_TYPE_NOTE,$y21158,$na7ff0); $p71671['OriginalAlias']=$v17901; $t33dd5='e2m_draft'; $q5ce5d=array ( '*note' => $p71671, 'alias' => $v17901, ); } $se449c=rc0c4( $p71671['FormatterID'],$p71671['Text'],'full' ); if(count($se449c) > 0){ t6be4($se449c); } try { qaa79('Notes',$p71671); if ($p71671['IsPublished']) { if (vd2e1($p71671)) { $p71671['IsIndexed']='1'; qaa79('Notes',$p71671); } b5b68($p71671); } $w1fa03=[ 'success' => true, 'data' => [ 'status' => 'saved', 'new-alias' => $v17901, 'note-url' => x83c8($t33dd5,$q5ce5d), 'note-edit-url' => x83c8('e2m_note_edit',$q5ce5d) ] ]; $result=(int)$y21158; } catch (AeMySQLException $e){ b12f6($e,'Could not update record'); $w1fa03=[ 'success' => false, 'error' => [ 'message' => 'Cannot update record ('. mysqli_error(). ')' ] ]; $result=false; } } if ($w65f31!=$bb4960){ a53f1(array ('NoteID' => $y21158)); foreach ($xa6168 as $le4d23){ $u70b77=n0188($le4d23); if (!$u70b77){ $u70b77['ID']=e03de($le4d23); } u0738( "INSERT INTO `". $_config['db_table_prefix']."NotesKeywords` ". "(`SubsetID`, `NoteID`, `KeywordID`) ". "VALUES (". ((int)$_config['db_table_subset']) .", ". ((int)$y21158) .", ". ((int)$u70b77['ID']). ")", 'add new tag bindings' ); } } if ( $z98ea6!='ajaxresult' and $result and $_POST['instant-publish']=='yes' ){ $_POST['note-id']=$y21158; e2s_note_publish(); } } else { $w1fa03=[ 'success' => false, 'error' => [ 'message' => 'Title or text is empty' ] ]; $_fp_error=FP_TITLE_OR_TEXT_EMPTY; $result=false; } } else { $w1fa03=[ 'success' => false, 'error' => [ 'message' => 'No note id/new specified' ] ]; $_fp_error=FP_NO_ID_OR_NEW; $result=false; } gcc38(x83c8('e2s_dump', array ())); } catch (AeMySQLException $e){ b12f6($e); $w1fa03=[ 'success' => false, 'error' => [ 'message' => 'Database error' ] ]; $result=false; } if ($z98ea6=='ajaxresult') return json_encode($w1fa03); else return$result; } function u3456($w1653c,$p0604c){ global$_config; if (!($w1653c and $p0604c) and !we852()) { if(Log::$ned2b5)__log('Error: e2_notes_count_generic called for invisible items unsecurely'); return null; } if (!is_bool($w1653c) or !is_bool($p0604c)) { if(Log::$ned2b5)__log ('Error: e2_notes_count_generic called with non-bool params'); return null; } if (!$w1653c and !$p0604c){ if(Log::$ned2b5)__log ('Error: e2_notes_count_generic called with nonsensical parameters'); return null; } $xd29bb=( CACHES_FOLDER . 'notes-count-p'. (int)$w1653c . ($w1653c ? ('v'. (int)$p0604c):'') . '.txt' ); $result=false; if(CACHE_NOTES_COUNTS and is_file($xd29bb)) { $result=@file_get_contents($xd29bb); } if(is_numeric($result) and $result > 0){ return$result; } else { $result=null; try { u0738( "SELECT COUNT(*) As NotesCount FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=". (int)$w1653c. " ". ($w1653c ? ( "AND `IsVisible`=". (int)$p0604c ):""), 'count notes with flags p'. (int)$w1653c . ($w1653c ? ('v'. (int)$p0604c):'') ); $result=d0d6b(); $result=$result[0]['NotesCount']; if(CACHE_NOTES_COUNTS)k6e52($xd29bb,$result); } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Could not count notes'); } return$result; } } function m5421($a1cb25){ $ya80da=$a1cb25; $ya80da=preg_match( '/^(\<\/div\>)?\<p( class\=\"lead\")?\>(.*)\<\/p\>$/m', $ya80da, $j9c28d ); $ya80da=$j9c28d[3]; if (!$ya80da)$ya80da=$a1cb25; $ya80da=str_replace(array ( '<p>','<blockquote>','<ul>','<ol>','<br />', ), "\n",$ya80da); $ya80da=trim(strip_tags($ya80da)); $w4d575=mb_strpos($ya80da,"\n"); if ($w4d575!==false){ $ya80da=mb_substr($ya80da,0,$w4d575); $ya80da=trim($ya80da,' :.()'."\n"); } if(preg_match('/^(.{100,}?)[:.!?()]|'."\n".'/s',$ya80da,$j9c28d)) { $ya80da=trim($j9c28d[0],' :.()'."\n"); } if(preg_match('/^(.{150,}?)[:.!?(),]/s',$ya80da,$j9c28d)) { $ya80da=trim($j9c28d[0],' :.()'."\n"); } if(preg_match('/^(.{200,}?)[:.!?(), ]/s',$ya80da,$j9c28d)) { $ya80da=trim($j9c28d[0],' :.()'."\n"); } if(in_array($ya80da[strlen($ya80da)-1], array (',',' '))) { $ya80da=trim($ya80da,', '). '...'; } if(mb_strlen($ya80da) > 250){ $ya80da=mb_substr($ya80da,0,250). '...'; } if(mb_substr($ya80da, -1)==='.')$ya80da=mb_substr($ya80da,0, -1); if(mb_substr($ya80da, -1)===':')$ya80da=mb_substr($ya80da,0, -1); if(mb_substr($ya80da, -1)==='!')$ya80da=mb_substr($ya80da,0, -1); return $ya80da; } function yb44b($w39a37,$o15514=false){ if ($o15514) return true; return $w39a37['IsVisible'] and $w39a37['Stamp'] <= time(); } function w6f32($o15514=false){ if ($o15514){ return ''; } else { return 'AND (n.`IsVisible` = 1 AND n.`Stamp` <= '. time() .') '; } } function e2_populate_read_counts_in_notes_ctree_($w6b12c){ global$_config; $zc6b5b=array(); foreach ($w6b12c as $d8ce4b => $ke244c){ if (@$ke244c['_']['_id']) { $zc6b5b[] = "(`EntityID` = ". $ke244c['_']['_id'].")"; } } if(count($zc6b5b)) { $zc6b5b=implode(' OR ',$zc6b5b); try { u0738( "SELECT `EntityID`, SUM(`ReadCount`) ReadCount ". "FROM `". $_config['db_table_prefix']."Actions` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (". $zc6b5b .") ". "GROUP BY `EntityID`", 'get read counts to populate notes CTree' ); $cfa816=d0d6b(); foreach ($cfa816 as $n33c9b){ $t0980a[$n33c9b['EntityID']] = $n33c9b['ReadCount']; } foreach ($w6b12c as $d8ce4b => $ke244c){ $w6b12c[$d8ce4b]['read-count']=$t0980a[$ke244c['_']['_id']]; } } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Could not populate read counts in notes ctree'); } } return $w6b12c; } define('DRAFT_PREVIEW_LENGTH',100); function e2m_drafts(){ global$_strings,$_config; if(Log::$ned2b5)__log('Drafts list: Working...'); $gda48a=null; if(CACHE_DRAFTS and is_file(CACHE_FILENAME_DRAFTS)) { $gda48a=@unserialize(file_get_contents(CACHE_FILENAME_DRAFTS)); } if(CACHE_DRAFTS and is_array($gda48a)) { if(Log::$ned2b5)__log('Drafts list: Retrieve cached ctree'); } else { if(Log::$ned2b5)__log('Drafts list: Assemle cacheable ctree...'); $gda48a=array(); if(Log::$ned2b5)__log('Drafts list: Select'); $x3f2a5=''; if($_config['limit_drafts']) { $x3f2a5="LIMIT ". ((int)$_config['limit_drafts']); } u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=0 ". "ORDER BY `SourceID` DESC, `LastModified` DESC ". $x3f2a5, 'get drafts to display on Drafts page' ); $result=d0d6b(); $z4358b=array(); foreach($result as $d8ce4b => $w39a37){ $saad65=array(); $saad65['_']['_id']=$w39a37['ID']; $saad65['_']['_ord']=$d8ce4b; $saad65['_']['_ord_max']=count($result)-1; $saad65['href']=x83c8('e2m_draft', array ('*note' => $w39a37)); $saad65['title']=u6f10(htmlspecialchars($w39a37['Title'],ENT_NOQUOTES,HSC_ENC)); if (isset ($saad65['image-href'])) unset ($saad65['image-href']); $w39a37['_']['_id']=$w39a37['ID']; $w39a37['_']['_ord']=0; $w39a37['_']['_ord_max']=0; $q8e4cd=o6791($w39a37,true); $saad65['_']['_resources']=null; if ($w39a37['FormatterID']=='neasden'){ $saad65['_']['_resources']=$q8e4cd['format-info']['resources-detected']; } elseif ($w39a37['FormatterID']=='calliope'){ $saad65['_']['_resources']=rc0c4( $w39a37['FormatterID'],$w39a37['Text'],'full' ); } $saad65=array_merge($saad65,q1a48($w39a37,false)); $saad65['text-fragment']=strip_tags($q8e4cd['text']); $c2ab2d=false; if(mb_strlen($saad65['text-fragment']) > DRAFT_PREVIEW_LENGTH) { $c2ab2d=mb_strpos($saad65['text-fragment'],'.',DRAFT_PREVIEW_LENGTH); } if ($c2ab2d!==false){ $saad65['text-fragment']=mb_substr($saad65['text-fragment'],0,$c2ab2d+1); } $gda48a[] = $saad65; } if(CACHE_DRAFTS)k6e52(CACHE_FILENAME_DRAFTS,serialize($gda48a)); } if(Log::$ned2b5)__log('Drafts list: Put thumbnail without cache'); if ($gda48a){ foreach ($gda48a as $d8ce4b => $t9e366){ $gda48a[$d8ce4b]['thumbs']=b2e82(@$t9e366['_']['_resources']); } } if(Log::$ned2b5)__log('Drafts list: Done'); $r2cb9d=array ( 'title' => $_strings['pt--drafts'], 'heading' => $_strings['pt--drafts'], ); if(count($gda48a)) { $r2cb9d['drafts']=$gda48a; } else { $r2cb9d['nothing']=$_strings['gs--no-drafts']; } return $r2cb9d; } function e2m_draft($parameters=array ()) { global$_strings,$_config,$x57de2; $saad65=$parameters['*note']; if (!$saad65 or $saad65['IsPublished']) { $parameters['alias']=$parameters['oalias']; unset($parameters['oalias']); $saad65=e2_noterec_with_parameters_($parameters); if ($saad65){ $gd58c0=x83c8('e2m_note', array ('*note' => $saad65)); return e2_go_to($gd58c0); } } if (!$saad65) return e2_error404_mode(); $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_ord']=0; $saad65['_']['_ord_max']=0; $q8e4cd=o6791($saad65); $k45513=array ( '.note-id' => $saad65['ID'], 'form-action' => x83c8('e2s_note_publish'), 'submit-text' => $_strings['fb--publish-draft'], 'can-schedule?' => false, 'can-publish?' => !@$_config['read_only'], ); return array ( 'title' => $saad65['Title'].' ('. $_strings['wd--draft'] .')', 'notes' => array ('only' => $q8e4cd), 'form' => 'form-note-publish', 'form-note-publish' => $k45513, ); } function e2m_draft_preview($parameters=array ()) { return e2_error404_mode(); } function e2_draft_alias_use_count($w176fe){ global$_config; if(Log::$ned2b5)__log('Drafts: find duplicate OriginalAliases...'); if(CACHE_DRAFTS_ALIAS_USE_COUNTS and is_file(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS)) { $rda552=@unserialize(file_get_contents(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS)); } if(CACHE_DRAFTS_ALIAS_USE_COUNTS and is_array($rda552)) { if(Log::$ned2b5)__log('Drafts: retrieve cached'); } else { if(Log::$ned2b5)__log('Drafts: assemle cacheable...'); $rda552=array(); u0738( "SELECT `OriginalAlias` FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=0 ". "ORDER BY `ID`", 'get original aliases of drafts to calculate use counts' ); $result=d0d6b(); $z4358b=array(); foreach($result as $d8ce4b => $w39a37){ @$rda552[$w39a37['OriginalAlias']] ++; } if(CACHE_DRAFTS_ALIAS_USE_COUNTS){ k6e52(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS,serialize($rda552)); } } return $rda552[$w176fe]; } function e2drafts__preview_key($saad65){ return md5($saad65['Text'].$saad65['LastModified']); } function h29a1(){ global$_strings,$_user_folder_name; $ceccd7='http://'. $_strings['e2--website-host'] .'/'; $x68966='('. $_strings['e2--release'] .' '. E2_RELEASE .', v'. E2_VERSION .')'; return [ 'built?' => BUILT, 'installed?' => (n2ac5()!==null), 'version' => 'v'. E2_VERSION, 'version-description' => $_strings['e2--vname-aegea'] .' '. $x68966, 'user-folder-name' => $_user_folder_name, 'cookie-prefix' => v8c3b(), 'href' => $ceccd7, 'about' => ( '<span title="E2 '.$x68966 .'">'. $_strings['e2--powered-by'] .' '. '<a href="'. $ceccd7 .'" class="nu"><u>'. $_strings['e2--vname-aegea'] .'</u>'. '<span class="e2-svgi">'. kf42c('aegea') .'</span></a></span>' ), ]; } function rc4da($uc48ba,$w6b12c,$o89650,$gcadc1,$he22d5){ global$full_blog_url,$content, $_config, $_candies_indexable, $_candies_indexable_conditionally, $_template, $_newsfeeds, $_current_url; $meta['base-href']=$full_blog_url. '/'; $meta['current-href']=$_current_url; $meta['stylesheets']=l37ca(); $meta['scripts']=o4753(); $meta['newsfeeds']=$_newsfeeds; $meta['favicon-type']='image/x-icon'; $meta['favicon-href']='favicon.ico'; if ($ra01d9=f2461()) { $meta['favicon-type']=oc952($ra01d9); $meta['favicon-href']=$ra01d9; $meta['apple-touch-icon-href']=f2461('square'); } $meta['navigation-links'] = [[ 'rel' => 'index', 'href' => x83c8('e2m_frontpage', ['page' => 1]), 'id' => 'link-index', ]]; if (!empty ($he22d5)) { foreach (['prev','next','earlier','later'] as $mc47d1){ if(array_key_exists($mc47d1 .'-href',$he22d5)) { $y7ffc4=$mc47d1; if ($mc47d1=='earlier')$y7ffc4='prev'; if ($mc47d1=='later')$y7ffc4='next'; $meta['navigation-links'][] = [ 'rel' => $y7ffc4, 'href' => $he22d5[$mc47d1 .'-href'], 'id' => 'link-'. $mc47d1, ]; } } } $c1e2ad='noindex, follow'; if (@$_config['index_follow_everything']) { $c1e2ad='index, follow'; } if(in_array($uc48ba,$_candies_indexable)) { $meta['robots']='index, follow'; } if(in_array($uc48ba,$_candies_indexable_conditionally)) { $meta['robots']=$c1e2ad; } $meta['viewport']=$_template['meta_viewport']; if(is_file(MEDIA_ROOT_FOLDER.'manifest.json')) { $meta['manifest-href']=$full_blog_url. '/manifest.json'; } $meta['og-images'] = array (); if(is_array($w6b12c['only']['og-images'])) { $meta['og-images']=$w6b12c['only']['og-images']; $meta['twitter-card']='summary_large_image'; } if(is_array($o89650['og-images'])) { $meta['og-images']=$o89650['og-images']; $meta['twitter-card']='summary_large_image'; } if (!count($meta['og-images'])) { $meta['og-images'] = array ($gcadc1['userpic-large-href']); $meta['twitter-card']='summary'; } return$meta; } function o5e47(){ global$_superconfig,$_config; $u34a31=[ 'new-note-href' => x83c8('e2m_write'), 'drafts-href' => x83c8('e2m_drafts'), 'drafts-count' => (int)u3456(false,true), 'settings-href' => x83c8('e2m_settings'), 'theme-preview-href' => x83c8('e2m_theme_preview', array ('theme' => '')), 'password-href' => x83c8('e2m_password', array ('recovery-key' => '')), 'database-href' => x83c8('e2m_database'), 'timezone-href' => x83c8('e2m_timezone'), 'sessions-href' => x83c8('e2m_sessions'), 'sign-out-href' => x83c8('e2m_sign_out'), ]; if (rda67()) { $u34a31['get-backup-href']=x83c8('e2m_get_backup'); } if (@$_config['read_only']) { unset ($u34a31['new-note-href']); unset ($u34a31['settings-href']); unset ($u34a31['timezone-href']); } if (@$_superconfig['disallow_themes_preview']) { unset ($u34a31['theme-preview-href']); } if (@$_superconfig['disallow_db_config']) { unset ($u34a31['database-href']); } list ($mfe9e2,$w85ee4,$j20699)=v2a6b(); if ($mfe9e2){ $u34a31['new-comments-count']=$mfe9e2; $u34a31['new-comments-href']=$j20699; } return $u34a31; } function e2m_tags(){ global$_strings; $r2cb9d['title']=$_strings['pt--tags']; $r2cb9d['heading']=$_strings['pt--tags']; $r2cb9d['tags']=ie531([]); $ecd342=ubb5b(true); if ($ecd342===null){ $r2cb9d['unavailable?']=true; } else { $r2cb9d['tags']['each']=$ecd342; if(count($ecd342)==0){ $r2cb9d['nothing']=$_strings['gs--no-tags']; } } return $r2cb9d; } function e2m_tag($parameters=array ()) { global $settings, $_config, $_current_tag, $_strings, $e71860, $full_blog_url; if(Log::$ned2b5)__log('Tag {'); if(array_key_exists('*tags',$parameters)) { $l59aeb=$parameters['*tags']; } if (!$l59aeb[0]) return e2_error404_mode(); $qd7df5=$l59aeb[0]; $e7186e=$parameters['tag-alias']; if(count($l59aeb)==1){ $_current_tag=$qd7df5['Keyword']; } $e71860=$parameters['page']; $gc2b7b=$_config['db_table_prefix']; $hd7e5d=$settings['appearance']['notes_per_page']; foreach ($l59aeb as $t9e366) if ($t9e366){ $o56790[] = "nk.KeywordID=". $t9e366['ID']; } $o56790='('.implode(' OR ',$o56790).')'; $o15514=we852(); $o56790.='AND IsPublished=1 '; $o56790.=w6f32($o15514); $i9b0c2=count($l59aeb); $v7a86c=($e71860-1)*$hd7e5d; $maa9f7=$hd7e5d; $lac5c7=( "SELECT SQL_CALC_FOUND_ROWS n.*, COUNT(*) ". "FROM `". $gc2b7b ."Notes` n ". "JOIN `". $gc2b7b ."NotesKeywords` nk ON nk.`NoteID` = n.`ID` ". "WHERE n.`SubsetID`=". $_config['db_table_subset'] ." ". "AND nk.`SubsetID`=". $_config['db_table_subset'] ." ". "AND ". $o56790 . "GROUP BY n.ID ". "HAVING COUNT(*)>=". $i9b0c2 ." ". "ORDER BY n.`Stamp` DESC ". "LIMIT ". $v7a86c .", ". $maa9f7 ); u0738($lac5c7); $result=d0d6b(); u0738("SELECT FOUND_ROWS() AS cnt"); $e67363=d0d6b(); $ifbb44=$e67363 ? (int)$e67363[0]['cnt']:0; $db3b32=array(); if ($ifbb44){ $iae0fe=ceil($ifbb44/$hd7e5d); $db3b32['timeline?']=true; $db3b32['count']=$iae0fe; $db3b32['this']=$e71860; $db3b32['earlier-title']=$_strings['gs--earlier']; $db3b32['later-title']=$_strings['gs--later']; $o920fa=$parameters; if ($e71860 < $iae0fe){ $o920fa['page']=$e71860+1; $db3b32['earlier-href']=x83c8('e2m_tag',$o920fa); } if ($e71860 > 1){ $o920fa['page']=$e71860-1; $db3b32['later-href']=x83c8('e2m_tag',$o920fa); } } if ($e71860 > $iae0fe){ return e2_error404_mode(); } if ($ifbb44==0){ if (!$o15514){ return e2_error404_mode(); } if ($e71860!=1){ return e2_error404_mode(); } } $z4358b=[]; foreach($result as $d8ce4b => $saad65){ $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_ord']=$d8ce4b; $saad65['_']['_ord_max']=count($result)-1; $z4358b[] = o6791($saad65); } if ($i9b0c2==1){ if ($o15514){ $n97a59['edit-href']=x83c8( 'e2m_tag_edit', array ('tag-alias' => $e7186e) ); } if ((string)$qd7df5['Description']!==''){ $o2bfe4=bb7f1($qd7df5['Description'],'full'); $f67daf=$o2bfe4['text-final']; $n97a59['description']=$f67daf; $n97a59['description-format-info']=$o2bfe4['meta']; a57ad(@$o2bfe4['meta']['links-required']); } $w3ad42=x83c8('e2m_tag_rss', array ('tag-alias' => $e7186e)); $w9d19f=x83c8('e2m_tag_json', array ('tag-alias' => $e7186e)); q3010( 'rss', n6f51() .': '. $qd7df5['Keyword'], $w3ad42 ); q3010( 'json', n6f51() .': '. $qd7df5['Keyword'], $w9d19f ); $n97a59['og-images']=tdbcc( 'tag',$qd7df5['ID'], $n97a59['description-format-info']['resources-detected'] ); } $y96963=( e2l_get_string('pt--n-posts', array ('number' => $ifbb44)). ' '. $_strings['gs--tagged'] ); $p8235e=array(); foreach ($l59aeb as $t9e366){ $p8235e[] = htmlspecialchars($t9e366['Keyword'],ENT_COMPAT,HSC_ENC); } $p8235e=implode(', ',$p8235e); $wb73b1=htmlspecialchars($qd7df5['PageTitle'],ENT_COMPAT,HSC_ENC); if ((string)$wb73b1!==''){ $ld5d3d=$wb73b1; $hd6b14=$y96963 .' '. $p8235e; $cf74f5=$wb73b1; } else { $ld5d3d=n6f51() .': '. $y96963 .' '. $p8235e; $hd6b14=$y96963; $cf74f5=$p8235e; } $r2cb9d=array ( 'title' => $ld5d3d, 'superheading' => $hd6b14, 'heading' => $cf74f5, 'pages' => $db3b32, 'notes' => $z4358b, 'tags' => ie531($parameters), ); if ($f67daf){ $r2cb9d['summary']=m5421($f67daf); } if(count($l59aeb)==1){ $r2cb9d['tag']=$n97a59; if (we852()) { $r2cb9d['related-edit-href']=$n97a59['edit-href']; $r2cb9d['related-edit-title']=$_strings['tt--edit-tag']; } } if(Log::$ned2b5)__log('} // Tag'); return $r2cb9d; } function e2m_tag_edit($parameters=array()) { global$_strings; if(array_key_exists('*tag',$parameters)) { $qd7df5=$parameters['*tag']; } if (!$qd7df5) return e2_error404_mode(); $se449c=rc0c4( 'neasden',$qd7df5['Description'],'full' ); $t75e1b=hf898( 'tag',$qd7df5['ID'],$se449c ); t2f83( 'Keywords', $qd7df5, $se449c ); $hc999b=yd10e(); $z480ee=[ 'enabled?' => x1363($hc999b), 'each' => $t75e1b, 'upload-action' => x83c8('e2j_file_upload'), 'remove-action' => x83c8('e2j_file_remove'), ]; $rcd831=array ( '.tag-id' => $qd7df5['ID'], '.formatter-id' => 'neasden', 'form-action' => x83c8('e2s_tag_edit'), 'submit-text' => $_strings['fb--save-changes'], 'tag' => htmlspecialchars($qd7df5['Keyword'],ENT_COMPAT,HSC_ENC), 'page-title' => htmlspecialchars($qd7df5['PageTitle'],ENT_COMPAT,HSC_ENC), 'page-title-placeholder' => htmlspecialchars($qd7df5['Keyword'],ENT_COMPAT,HSC_ENC), 'urlname' => htmlspecialchars($parameters['tag-alias'],ENT_COMPAT,HSC_ENC), 'description' => htmlspecialchars($qd7df5['Description'],ENT_COMPAT,HSC_ENC), 'favourite?' => (bool)$qd7df5['IsFavourite'], 'space-usage' => zaf64($hc999b), ); $rcd831['.cache-sensitive-hash']=md5( $rcd831['tag'] . $rcd831['uploads'] . $rcd831['urlname'] ); $r2cb9d=array ( 'body-uploads-enabled?' => x1363($hc999b), 'title' => $_strings['pt--tag-edit'] .': '. $qd7df5['Keyword'], 'heading' => $_strings['pt--tag-edit'], 'form' => 'form-tag', 'form-tag' => $rcd831, 'uploads' => $z480ee, 'related-delete-href' => x83c8('e2m_tag_delete', array ('*tag' => $qd7df5)), ); return $r2cb9d; } function e2m_tag_flag_ajax($parameters){ r705b([ 'flag-name' => 'tag', 'candy-name' => 'e2m_tag_flag_ajax', 'parameters' => $parameters, 'flipping-function' => function () use ($parameters){ y2e88($parameters); }, ]); } function y2e88($parameters){ if(array_key_exists('*tag',$parameters)) { $qd7df5=$parameters['*tag']; } if (!$qd7df5) return e2_error404_mode(); @unlink(CACHE_FILENAME_FAVTAGS); @unlink(CACHE_FILENAME_TAGS); @unlink(CACHE_FILENAME_TAGS_FULL); @unlink(CACHE_FILENAME_TAGS_AUTHOR); @unlink(CACHE_FILENAME_TAGS_AUTHOR_FULL); qaa79('Keywords', array ( 'ID' => $qd7df5['ID'], $parameters['flag'] => (int) ($parameters['value']==1), )); return true; } function e2m_tag_delete($parameters=array()) { global$_strings; if(array_key_exists('*tag',$parameters)) { $qd7df5=$parameters['*tag']; } if (!$qd7df5) return e2_error404_mode(); $decc14=array ( '.tag-id' => $qd7df5['ID'], 'caution-text' => e2l_get_string('gs--tag-will-be-deleted-notes-remain', array ( 'tag' => htmlspecialchars($qd7df5['Keyword'],ENT_COMPAT,HSC_ENC) )), 'tag' => htmlspecialchars($qd7df5['Keyword'],ENT_COMPAT,HSC_ENC), 'form-action' => x83c8('e2s_tag_delete'), 'submit-text' => $_strings['fb--delete'], ); $r2cb9d=array ( 'title' => $_strings['pt--tag-delete'] .': '. $qd7df5['Keyword'], 'heading' => $_strings['pt--tag-delete'], 'form' => 'form-tag-delete', 'form-tag-delete' => $decc14, ); return $r2cb9d; } function e2m_untagged(){ global$_strings,$_config; return xd864(array ( 'query' => "SELECT n.* FROM `". $_config['db_table_prefix']."Notes` n ". "LEFT OUTER JOIN `". $_config['db_table_prefix']."NotesKeywords` nk ". "ON nk.`NoteID` = n.`ID` ". "WHERE n.`SubsetID`=". $_config['db_table_subset'] ." ". "AND nk.`SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". "AND nk.`KeywordID` IS NULL ". w6f32(we852()). "ORDER BY n.`Stamp` DESC", 'title' => $_strings['pt--posts-without-tags'], 'heading' => $_strings['pt--posts-without-tags'], 'nothing' => $_strings['gs--no-posts-without-tags'], 'show-all-notes' => true, )); return $r2cb9d; } function e2s_tag_edit(){ global$_strings,$_config; $s76f09=$le4d23=$f67daf=$na7ff0=''; if(array_key_exists('tag-id',$_POST)) $s76f09=$_POST['tag-id']; if(array_key_exists('tag',$_POST)) $le4d23=$_POST['tag']; if(array_key_exists('page-title',$_POST)) $wb73b1=trim($_POST['page-title'],"\r\n"); if(array_key_exists('description',$_POST)) $f67daf=trim($_POST['description'],"\r\n"); if(array_key_exists('urlname',$_POST)) $na7ff0=trim($_POST['urlname'],"\r\n"); if(array_key_exists('cache-sensitive-hash',$_POST)) { $m3c58b=$_POST['cache-sensitive-hash']; $qbb9a8=md5($le4d23.$na7ff0); } $o73f92=m07e3('Notes'); if(stripos($o73f92['Collation'],'utf8mb4')!==0){ $le4d23=uff7c($le4d23); $wb73b1=uff7c($wb73b1); $f67daf=uff7c($f67daf,true); } u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = ".((int)$s76f09)."", 'get tag record to update' ); $b53e61=d0d6b(); if(count($b53e61)!=1) die; $rb19ad=$b53e61[0]; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `Keyword` = '". a7928($le4d23) ."' ". "AND (`ID` != ".((int)$s76f09).")", 'make sure new tag name does not conflict with existing ones' ); $b53e61=d0d6b(); if(count($b53e61)==0){ if ($qbb9a8!=$m3c58b){ i7996(); } @unlink(CACHE_FILENAME_FAVTAGS); @unlink(CACHE_FILENAME_TAGS); @unlink(CACHE_FILENAME_TAGS_FULL); @unlink(CACHE_FILENAME_TAGS_AUTHOR); @unlink(CACHE_FILENAME_TAGS_AUTHOR_FULL); $rb19ad['ID'] = ((int)$s76f09); $rb19ad['Keyword']=$le4d23; $rb19ad['PageTitle']=$wb73b1; $rb19ad['Description']=$f67daf; qaa79('Keywords',$rb19ad); $v17901=od712( 'set',ENTITY_TYPE_TAG,$rb19ad['ID'],$na7ff0 ); e2_go_to(x83c8('e2m_tag', array ('tag-alias' => $v17901))); } else { q8a40($_strings['er--cannot-rename-tag'],E2E_USER_ERROR); j4930(); } die; } function e2s_tag_delete(){ global$_strings,$_config; $xb80bb=((int)$_POST['tag-id']); i7996(); @unlink(CACHE_FILENAME_FAVTAGS); @unlink(CACHE_FILENAME_TAGS); @unlink(CACHE_FILENAME_TAGS_FULL); @unlink(CACHE_FILENAME_TAGS_AUTHOR); @unlink(CACHE_FILENAME_TAGS_AUTHOR_FULL); u0738( "DELETE FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $xb80bb ); u0738( "DELETE FROM `". $_config['db_table_prefix']."NotesKeywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `KeywordID`=". $xb80bb ); e2_go_to(x83c8('e2m_tags')); die; } function faf16($e07f25){ global$_current_tag,$_config; $m9df9d=null; if(CACHE_FAVTAGS and is_file(CACHE_FILENAME_FAVTAGS)) { $m9df9d=@unserialize(file_get_contents(CACHE_FILENAME_FAVTAGS)); } if (!is_array($m9df9d)) { try { u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND IsFavourite = 1 ORDER BY `Keyword`", 'get favorite tags for tags menu' ); $h9cdff=d0d6b(); $m9df9d=array(); foreach ($h9cdff as $b04ff0){ $vc6827['tag']=htmlspecialchars($b04ff0['Keyword'],ENT_NOQUOTES,HSC_ENC); $vc6827['href']=x83c8( 'e2m_tag', array ('*tag' => $b04ff0) ); $m9df9d[] = $vc6827; } if(CACHE_FAVTAGS)k6e52(CACHE_FILENAME_FAVTAGS,serialize($m9df9d)); } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Count not get tags menu from database'); } } if (!is_array($m9df9d)) return null; $d8a4f1=false; foreach ($m9df9d as $d8ce4b => $t9e366){ $m9df9d[$d8ce4b]['current?'] = ( $m9df9d[$d8ce4b]['tag']==$_current_tag ); if ($m9df9d[$d8ce4b]['current?']) { $d8a4f1=true; $f08187=$e07f25; $f08187['flag']='IsFavourite'; $f08187['value']=0; if (we852()) { $m9df9d[$d8ce4b]['pinnable?']=true; $m9df9d[$d8ce4b]['pinned?']=true; $m9df9d[$d8ce4b]['pinned-toggle-href'] = ( x83c8('e2m_tag_flag_ajax',$f08187) ); } } } if (we852()) { if (!$d8a4f1 and array_key_exists('*tag',$e07f25)) { $ua55a9=$e07f25; $ua55a9['flag']='IsFavourite'; $ua55a9['value']=1; $nd5a7a=array ( 'tag' => htmlspecialchars($e07f25['*tag']['Keyword'],ENT_NOQUOTES,HSC_ENC), 'href' => x83c8('e2m_tag',$e07f25), 'current?' => true, 'pinnable?' => true, 'pinned?' => false, 'pinned-toggle-href' => x83c8('e2m_tag_flag_ajax',$ua55a9), ); $m9df9d[] = $nd5a7a; } } return $m9df9d; } function ace23($y21158){ global$_config; $c0dff3=array(); u0738( "SELECT k.* ". "FROM `". $_config['db_table_prefix']."Keywords` k, ". "`". $_config['db_table_prefix']."NotesKeywords` nk ". "WHERE k.`SubsetID`=". $_config['db_table_subset'] ." ". "AND nk.`SubsetID`=". $_config['db_table_subset'] ." ". "AND nk.`NoteID`=". ((int)$y21158) ." ". "AND k.`ID`=nk.`KeywordID` ". "ORDER BY `Keyword`", 'get tag records for note by id' ); $c0dff3=d0d6b(); return $c0dff3; } function a53f1($geaa60){ global$_config; $j316e8=array(); foreach (array ( 'ID', 'NoteID', 'KeywordID', ) as $s06e3d) if(array_key_exists($s06e3d,$geaa60)) { $w6a7f2[] = '`'. $s06e3d .'`'."='". a7928($geaa60[$s06e3d]) ."'"; if ($s06e3d=='ID')$t729d6='tagbinging-id'; if ($s06e3d=='NoteID')$t729d6='tagbinging-note-id'; if ($s06e3d=='KeywordID')$t729d6='tagbinging-tag-id'; $j316e8[$t729d6]=$geaa60[$s06e3d]; } $b1b1cc=( "DELETE FROM `". $_config['db_table_prefix']."NotesKeywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND ". implode(' AND ',$w6a7f2) ); u0738($b1b1cc); } function e03de($le4d23){ @unlink(CACHE_FILENAME_TAGS); @unlink(CACHE_FILENAME_TAGS_FULL); @unlink(CACHE_FILENAME_TAGS_AUTHOR); @unlink(CACHE_FILENAME_TAGS_AUTHOR_FULL); $rb19ad=array ( 'Keyword' => $le4d23, 'OriginalAlias' => od712('find',ENTITY_TYPE_UNSPECIFIED,'',$le4d23), 'Description' => '', ); $rb19ad=v9943('Keywords',$rb19ad); $z419a1=od712( 'set',ENTITY_TYPE_TAG,$rb19ad['ID'],$le4d23 ); if ($z419a1!=$rb19ad['OriginalAlias']) { $rb19ad['OriginalAlias']=$z419a1; qaa79('Keywords',$rb19ad); } return $rb19ad['ID']; } function ie531($parameters){ if (($o933dd=ubb5b()) === null) return []; $oc6ce7['each']=$o933dd; if(count($oc6ce7['each']) > 0){ $oc6ce7['href']=x83c8('e2m_tags'); } if (($nbd876=faf16($parameters)) !== null){ $oc6ce7['menu-each']=$nbd876; } return $oc6ce7; } function ubb5b($oe9dc9=false){ global$_config; $o15514=we852(); $xd29bb=CACHE_FILENAME_TAGS; if ($o15514)$xd29bb=CACHE_FILENAME_TAGS_AUTHOR; if ($oe9dc9){ $xd29bb=CACHE_FILENAME_TAGS_FULL; if ($o15514)$xd29bb=CACHE_FILENAME_TAGS_AUTHOR_FULL; } $k8da94=null; if(CACHE_TAGS and is_file($xd29bb)) { $k8da94=@unserialize(file_get_contents($xd29bb)); } if (!is_array($k8da94)) { try { u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "ORDER BY `Keyword`", 'get all tags' ); $z35016=array(); foreach (d0d6b() as $rb19ad){ $le4d23['tag']=htmlspecialchars($rb19ad['Keyword'],ENT_NOQUOTES,HSC_ENC); $le4d23['favourite?'] = (bool)$rb19ad['IsFavourite']; $le4d23['notes-count']=0; $le4d23['last-used']=0; $le4d23['freshness']=0; $le4d23['weight']=0; if ($oe9dc9){ $le4d23['href']=x83c8('e2m_tag', array ('*tag' => $rb19ad)); } $z35016[$rb19ad['ID']] = $le4d23; } u0738( "SELECT nk.KeywordID, COUNT(DISTINCT n.ID) as Count, max(n.Stamp) as LastUsed ". "FROM `". $_config['db_table_prefix']."NotesKeywords` nk, ". "`". $_config['db_table_prefix']."Notes` n ". "WHERE nk.`SubsetID`=". $_config['db_table_subset'] ." ". "AND n.`SubsetID`=". $_config['db_table_subset'] ." ". "AND n.`IsPublished` = 1 ". w6f32($o15514). "AND nk.`NoteID` = n.`ID` ". "GROUP BY nk.KeywordID", 'get tags ordering info' ); $b9fdd5=0; $e8f57c=0; $a06894=0; foreach (d0d6b() as $l28a42){ $vc6827 =& $z35016[$l28a42['KeywordID']]; $vc6827['notes-count']=$l28a42['Count']; if (@$vc6827['last-used'] < $l28a42['LastUsed']) { $vc6827['last-used']=$l28a42['LastUsed']; $e452b4=(time()-$vc6827['last-used']) / SECONDS_IN_A_YEAR; $vc6827['freshness']=pow(1/2,$e452b4); } $b9fdd5=max($b9fdd5,$vc6827['notes-count']); $e8f57c=max($e8f57c,$vc6827['freshness']); $a06894=max($a06894,$vc6827['notes-count']*$vc6827['freshness']); } $k8da94=array(); foreach ($z35016 as $f865c0 => $t9e366){ if (!$o15514 and $t9e366['notes-count']==0) continue; $p95e80=mb_strtolower($t9e366['tag']); $k8da94[$p95e80]=$t9e366; if ($e8f57c!=0){ $k8da94[$p95e80]['freshness']=$t9e366['freshness']/$e8f57c; } else { $k8da94[$p95e80]['freshness']=0; } if ($a06894!=0){ $k8da94[$p95e80]['weight'] = ( $t9e366['freshness']*$t9e366['notes-count']/$a06894 ); } else { $k8da94[$p95e80]['weight']=0; } if ($k8da94[$p95e80]['favourite?'])$k8da94[$p95e80]['weight']=1; } if(CACHE_TAGS)k6e52($xd29bb,serialize($k8da94)); } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Could not get tags from database'); } } return $k8da94; } function n0188($qd7df5){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `Keyword`='". a7928($qd7df5) ."'", 'get tag by name' ); $d8ce4b=d0d6b(); if (isset ($d8ce4b[0])) { return $d8ce4b[0]; } else { return null; } } function c8770($bd7ca3){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `OriginalAlias`='".a7928($bd7ca3)."'", 'get tag by legacy urlname name' ); $cfa816=d0d6b(); if (isset ($cfa816[0])) { return $cfa816[0]; } else { return null; } } function h4e28($xb80bb){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`='".((int)$xb80bb)."'", 'get tag by id' ); $cfa816=d0d6b(); if (isset ($cfa816[0])) { return $cfa816[0]; } else { return null; } } function e2_tagrecs_with_parameters_($parameters){ $ubdcf3=array(); if (@$parameters['tag-alias'] or $parameters['tag-alias']==='0'){ $ubdcf3=explode(',',$parameters['tag-alias']); } $c0dff3=array(); foreach ($ubdcf3 as $bd7ca3) if ($bd7ca3 or $bd7ca3==='0'){ if ( $uc45dd=e2_aliasrec_of_alias_(@$bd7ca3) and ($uc45dd['EntityType']==ENTITY_TYPE_TAG) and ($rb19ad=h4e28($uc45dd['EntityID'])) ) { $c0dff3[] = $rb19ad; } else { if ($q3ee3f=c8770($bd7ca3)) { $c0dff3[] = $q3ee3f; } } } return $c0dff3; } function s2e04(){ global$full_blog_url; static $o0d5f1; $b3c6e0=i7874(); if (empty ($o0d5f1)) { $o0d5f1=md5($full_blog_url .'email'. $b3c6e0); } return $o0d5f1; } function gd8c5(){ global$full_blog_url; static $l05fa8; $b3c6e0=i7874(); if (empty ($l05fa8)) { $l05fa8=md5($full_blog_url .'nospam'. $b3c6e0.date('n-Y')); } return $l05fa8; } function ce7ec(){ global$full_blog_url; static $d6f410; $b3c6e0=i7874(); if(empty($d6f410)) { $d6f410=md5($full_blog_url .'nospam'. $b3c6e0.date('n-Y',strtotime('-1 month'))); } return $d6f410; } function n41f3($y21158){ global$full_blog_url; $b3c6e0=i7874(); return v8c3b('comment_'. md5($full_blog_url .'nospam_cookie'. $b3c6e0.$y21158)); } function q7c9d(){ global$full_blog_url; $q83647=$_SERVER['HTTP_USER_AGENT']; $b3c6e0=i7874(); return md5($full_blog_url .'nospam_cookie'. $b3c6e0.$q83647); } function web9a(){ if ( array_key_exists('email',$_POST) and $_POST['email']!=='' ) return true; $l05fa8=gd8c5(); $d6f410=ce7ec(); if ( !array_key_exists($l05fa8,$_POST) and !array_key_exists($d6f410,$_POST) ) return true; if ( ( array_key_exists($l05fa8,$_POST) and $_POST[$l05fa8]!=='' ) or ( array_key_exists($d6f410,$_POST) and $_POST[$d6f410]!=='' ) ) return true; if ( !array_key_exists('comment',$_POST) or (strlen($_POST['comment']) > 6) ) return true; return false; } function e2_cookie_data_is_spam_suspicios_for_note_id_($y21158){ if ( !array_key_exists(n41f3($y21158),$_COOKIE) or ($_COOKIE[n41f3($y21158)] !== q7c9d()) ) return true; return false; } function e2m_comment($parameters=array ()) { e2_go_to(x83c8('e2m_note',$parameters)); die; } function e2m_comment_edit($parameters=array ()) { return q4fb7('edit',$parameters); } function q4fb7($p60cd8,$parameters=array ()) { global$_config,$_strings,$full_blog_url; $ld5d3d=$cf74f5=$_strings['pt--new-comment']; $c69b97='new'; if ($p60cd8=='edit'){ $l4032b=e2_commentrec_with_parameters_($parameters); $sc50d0=$_strings['fb--save-changes']; $w39a37=$l4032b['noterec']; $ld5d3d=$cf74f5=$_strings['pt--edit-comment']; $b1aec6=f86f8($w39a37,$l4032b,$parameters['comment-number']); $c69b97=$naca8d['ID']; if (!$l4032b){ return e2_error404_mode(); } $b80f02=array ( '.note-id' => $l4032b['NoteID'], '.comment-id' => $l4032b['ID'], '.comment-number' => $parameters['comment-number'], '.already-subscribed?' => false, '.gip' => $l4032b['GIP'], '.from' => substr($_SERVER['HTTP_REFERER'],strlen($full_blog_url)+1), 'create:edit?' => false, 'form-action' => x83c8('e2s_comment_process'), 'submit-text' => $sc50d0, 'show-subscribe?' => true, 'subscribe?' => (bool)$l4032b['IsSubscriber'], 'name' => htmlspecialchars($l4032b['AuthorName'],ENT_COMPAT,HSC_ENC), 'email' => htmlspecialchars($l4032b['AuthorEmail'],ENT_COMPAT,HSC_ENC), 'text' => htmlspecialchars($l4032b['Text'],ENT_COMPAT,HSC_ENC), 'email-field-name' => s2e04(), ); if (''!=trim($l4032b['IP'])) { $b80f02['ip']=$l4032b['IP']; } } $r2cb9d=array ( 'title' => $ld5d3d, 'heading' => $cf74f5, 'form' => 'form-comment', 'form-comment' => $b80f02, ); if (!empty ($b1aec6)) { $r2cb9d['comments'] = array ('each' => array ('only' => $b1aec6)); } return $r2cb9d; } function e2m_comment_reply($parameters=array ()) { global$_strings; $l4032b=e2_commentrec_with_parameters_($parameters); if (!$l4032b){ return e2_error404_mode(); } $w39a37=$l4032b['noterec']; $b1aec6=f86f8($w39a37,$l4032b,$parameters['comment-number']); $b1aec6['_']['_id']=$l4032b['ID']; $b1aec6['_']['_ord']=0; $b1aec6['_']['_ord_max']=0; $b1aec6['replying?'] = (bool)true; $r817c7=($l4032b['Reply']=='' or !$l4032b['IsReplyVisible']); $ld5d3d=$r817c7? $_strings['pt--reply-to-comment']:$_strings['pt--edit-reply-to-comment']; $s4dc70=array ( '.note-id' => $w39a37['ID'], '.comment-id' => $l4032b['ID'], '.reply-action' => $r817c7? 'new':'edit', 'form-action' => x83c8('e2s_comment_edit_reply'), 'submit-text' => $r817c7? $_strings['fb--publish']:$_strings['fb--save-changes'], 'create:edit?' => (bool) ($r817c7), 'reply-text' => htmlspecialchars($l4032b['Reply'],ENT_COMPAT,HSC_ENC), 'mail-back?' => (bool) ($r817c7), ); return array ( 'title' => $ld5d3d, 'heading' => $ld5d3d, 'comments' => array ('each' => array ('only' => $b1aec6)), 'form' => 'form-comment-reply', 'form-comment-reply' => $s4dc70, ); } function e2m_comment_delete($parameters=array ()) { global$_strings,$settings,$qcbcce,$_config; $l4032b=e2_commentrec_with_parameters_($parameters); $y21158=$l4032b['NoteID']; if (!$l4032b){ return e2_error404_mode(); } e2_drop_caches_for_note_($y21158); @unlink(USER_FOLDER. '/last-comment.psa'); u0738( "DELETE FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". ((int)$l4032b['ID']). "'" ); j4930(); die; } function e2m_comment_reply_delete($parameters=array ()) { global$_strings,$settings,$_config; $l4032b=e2_commentrec_with_parameters_($parameters); if (!$l4032b){ return e2_error404_mode(); } u0738( "UPDATE `". $_config['db_table_prefix']."Comments` SET ". "`Reply`='', ". "`IsReplyFavourite`='0' ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=".((int)$l4032b['ID']) ); j4930(); die; } function e2m_unsubscribe($parameters){ global$_strings,$_config; $d70a17="ORDER BY `ID` DESC"; $q260ca=false; $w39a37=$parameters['*note']; $y21158=$w39a37['ID']; $a0c83f=$parameters['unsubscribe-email']; $b1bc29=$parameters['unsubscribe-key']; $a0c83f=str_replace(' ','+',$a0c83f); if ($y21158){ u0738( "SELECT `ID`, `Stamp` FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". $y21158 ." ". "AND `IsSubscriber`=1 ". "AND `AuthorEmail`='". $a0c83f ."' ". $d70a17, 'get subscribers comments ids' ); $result=d0d6b(); if(count($result) < 1) { $r2cb9d['unsubscribe']['error-message']=$_strings['gs--you-are-not-subscribed']; } else { $z06d4c=@$result[0]; $e97f69=md5($z06d4c['ID'].$z06d4c['Stamp'] .'x'); if ($b1bc29==$e97f69){ u0738( "UPDATE `". $_config['db_table_prefix']."Comments` ". "SET `IsSubscriber`=0 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". $y21158 ." ". "AND `AuthorEmail` = '". a7928($a0c83f). "'", 'unsubscribe' ); $q260ca=true; $r2cb9d['unsubscribe']['note-title']=u6f10( htmlspecialchars($w39a37['Title'],ENT_COMPAT,HSC_ENC) ); $r2cb9d['unsubscribe']['note-href']=x83c8( 'e2m_note', array ('*note' => $w39a37) ); } if (!$q260ca){ $r2cb9d['unsubscribe']['error-message']=$_strings['gs--unsubscription-didnt-work']; } } } else { $r2cb9d['unsubscribe']['error-message']=$_strings['gs--post-not-found']; } if ($q260ca){ $ld5d3d=$_strings['pt--unsubscription-done']; } else { $ld5d3d=$_strings['pt--unsubscription-failed']; } $r2cb9d['unsubscribe']['success?']=$q260ca; $r2cb9d['title']=$ld5d3d; $r2cb9d['heading']=$ld5d3d; return $r2cb9d; } function e2m_comment_flag($parameters){ k6e30($parameters); e2_go_to(x83c8('e2m_note',$parameters)); die; } function e2m_comment_flag_ajax($parameters){ r705b([ 'flag-name' => 'comment', 'candy-name' => 'e2m_comment_flag_ajax', 'parameters' => $parameters, 'flipping-function' => function () use ($parameters){ k6e30($parameters); }, ]); } function k6e30($parameters){ $l4032b=e2_commentrec_with_parameters_($parameters); $y21158=$l4032b['NoteID']; if ($l4032b){ qaa79('Comments', array ( 'ID' => $l4032b['ID'], $parameters['flag'] => (int) ($parameters['value']==1), )); e2_drop_caches_for_note_($y21158); } } function e2s_comment_process(){ global$_strings,$_fp_error; list ($y21158,$c69b97,$x9d090)=s1a90(); if(Log::$ned2b5)__log('Comments: processed, noteid <'. $y21158 .'>, commentid <'. $c69b97 .'>'); if (!$c69b97){ $s05c36=''; if($_fp_error==FP_NOT_COMMENTABLE){ q8a40($_strings['er--post-not-commentable'],E2E_USER_ERROR); } elseif($_fp_error==FP_EMPTY_FIELD){ q8a40($_strings['er--name-email-text-required'],E2E_USER_ERROR); } elseif($_fp_error==FP_COMMENT_TOO_LONG){ $faa731=$_strings['gs--comment-too-long']; $s05c36=$_strings['gs--comment-too-long-description']; } elseif($_fp_error==FP_COMMENT_DOUBLE_POST){ $faa731=$_strings['gs--comment-double-post']; $s05c36=$_strings['gs--comment-double-post-description']; } elseif($_fp_error==FP_COMMENT_SPAM_SUSPECT){ $faa731=$_strings['gs--comment-spam-suspect']; $s05c36=$_strings['gs--comment-spam-suspect-description']; } else { q8a40($_strings['er--error-occurred'].' ('. $_fp_error .')'); } if ($s05c36){ $r2cb9d['title']=$faa731; $r2cb9d['heading']=$faa731; $r2cb9d['form']='form-unaccepted-comment'; $r2cb9d['form-unaccepted-comment'] = array ( 'reason' => $s05c36, 'text' => @htmlspecialchars($x9d090['text'],ENT_COMPAT,HSC_ENC), ); return $r2cb9d; } } if ($y21158){ e2_go_to(x83c8('e2m_note', array ('*note' => i4627($y21158)))); } else { e2_go_to(); } die; } function e2s_comment_edit_reply(){ global$_strings,$x57de2,$_config; $ae84af=@$_POST['text']; if(trim($ae84af)=='')$ae84af=''; $y21158=@$_POST['note-id']; $saad65=i4627($y21158); $c69b97=@$_POST['comment-id']; $z06d4c=q0d27($c69b97); $g54eb6=isset ($_POST['mail-back']); $k54fa9=time(); if (@$_POST['reply-action']=='new'){ $ue0e30=time(); } @unlink(e2_note_cache_filename_with_id_($y21158 .'-comments')); @unlink(e2_note_cache_filename_with_id_($y21158 .'-comments-author')); if ($z06d4c){ u0738( "UPDATE `". $_config['db_table_prefix']."Comments` SET ". "`Reply`='". a7928($ae84af) ."', ". ( isset ($ue0e30)? ( "`ReplyStamp`='". $ue0e30 ."', " ) : ( "" ) ). "`ReplyLastModified`='". $k54fa9 ."', ". "`IsReplyVisible`='1' ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=".((int)$c69b97), 'update comment reply' ); $gd58c0=x83c8('e2m_note', array ('*note' => $saad65)); if ($g54eb6 and $ae84af!=''){ $vc6827['comment-time'] = array ($z06d4c['Stamp'],g5c05()); $vc6827['commenter']=$z06d4c['AuthorName']; $vc6827['commenter-email']=$z06d4c['AuthorEmail']; $vc6827['comment-text']=$z06d4c['Text']; $vc6827['note-title']=u6f10($saad65['Title']); $vc6827['reply-time'] = array (time(),g5c05()); $vc6827['blog-author']=k2640(); $vc6827['note-href']=$gd58c0; $vc6827['comment-href']=$gd58c0; $vc6827['reply-text']=$ae84af; if(1){ $ade7a3=n3e5c( 'comment-reply',$vc6827 ); $lb904c=e2l_get_string( 'em--comment-reply', $vc6827 ); $k77613=$z06d4c['AuthorEmail']; $q1a49b='From: '. daed2(); fa41b($k77613,$lb904c,$ade7a3,$q1a49b); } if(1){ unset ($vc6827['commenter-email']); $q1a49b='From: '. daed2(); foreach (pd225($saad65,$z06d4c['AuthorEmail']) as $x39c63){ $aba570=$x39c63['AuthorEmail']; $h6fd85=md5($x39c63['ID'].$x39c63['Stamp'].'x'); $vc6827['unsubscribe-href']=x83c8('e2m_unsubscribe', array ( '*note' => $saad65, 'unsubscribe-email' => $aba570, 'unsubscribe-key' => $h6fd85, ) ); $k77613=$aba570; $ade7a3=n3e5c('comment-reply-to-public',$vc6827); $lb904c=e2l_get_string( 'em--comment-reply-to-public-subject', $vc6827 ); fa41b($k77613,$lb904c,$ade7a3,$q1a49b); } } } e2_go_to($gd58c0); } else { j4930(); } die; } function f86f8($saad65,$z06d4c,$ib1bc2){ global$_config,$full_blog_url; if(Log::$ned2b5)__log('Package comment '. $z06d4c['ID'] .'...'); if ($saad65===null){ $saad65=i4627($z06d4c['NoteID']); } $vc6827['number']=$ib1bc2; $a7b397=!empty ($z06d4c['IsGIPUsed']); $vc6827['gip-used?']=$a7b397; $vc6827['gip']=$vc6827['gip-used?']?$z06d4c['GIP']:''; $vc6827['name']=htmlspecialchars($z06d4c['AuthorName'],ENT_NOQUOTES,HSC_ENC); $vc6827['userpic-set?']=false; if ($a7b397){ $r51c69=AVATARS_FOLDER.$z06d4c['GIP'] .'-'. $z06d4c['GIPAuthorID'] .'.jpg'; if(is_file(MEDIA_ROOT_FOLDER.$r51c69)) { $vc6827['userpic-set?']=true; $vc6827['userpic-href']=$full_blog_url .'/'. $r51c69; } } $vc6827['name-href']=''; if ( $a7b397 and $z020fc=e2_get_user_profile_url($z06d4c['GIP'],$z06d4c['GIPAuthorID'],$z06d4c['AuthorProfileLink']) ) { $vc6827['name-href']=$z020fc; } if (we852()) { $vc6827['email']=htmlspecialchars($z06d4c['AuthorEmail'],ENT_NOQUOTES,HSC_ENC); if (''!=trim($z06d4c['IP'])) { $vc6827['ip']=$z06d4c['IP']; } } $vc6827['author-name']=k2640(); $vc6827['important?'] = (bool)$z06d4c['IsFavourite']; $vc6827['reply-visible?'] = (bool) ($z06d4c['IsVisible'] && $z06d4c['IsReplyVisible']); $vc6827['reply-important?'] = (bool)$z06d4c['IsReplyFavourite']; $vc6827['spam-suspect?'] = (bool)$z06d4c['IsSpamSuspect']; $v10a7e=array ((int)$z06d4c['Stamp'],l0923($saad65)); $vc6827['time']=$v10a7e; $vc6827['last-modified']=$v10a7e; if ($z06d4c['LastModified']) $vc6827['last-modified'] = array ((int)$z06d4c['LastModified'],l0923($saad65)); if ($z06d4c['ReplyStamp']) $vc6827['reply-time'] = array ((int)$z06d4c['ReplyStamp'],l0923($saad65)); if ($z06d4c['ReplyLastModified']) $vc6827['reply-last-modified'] = array ((int)$z06d4c['ReplyLastModified'],l0923($saad65)); if (we852()) { $vc6827['subscriber?'] = (bool)$z06d4c['IsSubscriber']; $vc6827['new?'] = (bool)$z06d4c['IsNew']; $vc6827['first-new?']=false; if (!@$_config['read_only']) { if ($z06d4c['IsFavourite']) { $vc6827['important-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ('*note' => $saad65,'comment-number' => $ib1bc2,'flag' => 'IsFavourite','value' => 0) ); } else { $vc6827['important-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ('*note' => $saad65,'comment-number' => $ib1bc2,'flag' => 'IsFavourite','value' => 1) ); } if ($z06d4c['IsReplyFavourite']) { $vc6827['reply-important-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2,'flag' => 'IsReplyFavourite','value' => 0 ) ); } else { $vc6827['reply-important-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2,'flag' => 'IsReplyFavourite','value' => 1 ) ); } $vc6827['edit-href']=x83c8( 'e2m_comment_edit', array ('*note' => $saad65,'comment-number' => $ib1bc2) ); $vc6827['removed-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsVisible','value' => !$z06d4c['IsVisible'] ) ); $vc6827['removed-reply-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsReplyVisible','value' => !$z06d4c['IsVisible'] ) ); $vc6827['removed-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsVisible','value' => 0 ) ); $vc6827['removed-reply-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsReplyVisible','value' => 0 ) ); $vc6827['replaced-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsVisible','value' => 1 ) ); $vc6827['replaced-reply-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsReplyVisible','value' => 1 ) ); $we36ef=x83c8( 'e2m_comment_reply', array ('*note' => $saad65,'comment-number' => $ib1bc2) ); if ($z06d4c['Reply']=='' or !$z06d4c['IsReplyVisible']) { $vc6827['reply-href']=$we36ef; } else { $vc6827['edit-reply-href']=$we36ef; } } } if(mb_strlen($z06d4c['Text']) > $_config['max_comment_length']) { $z06d4c['Text']=mb_substr($z06d4c['Text'],0,$_config['max_comment_length']); } $ub64b8=$saad65['FormatterID']==='raw'?'neasden':$saad65['FormatterID']; $o2bfe4=j154e($ub64b8,$z06d4c['Text'],'simple'); $vc6827['text']=$o2bfe4['text-final']; $vc6827['reply']=''; $vc6827['replying?'] = (bool)false; $vc6827['replied?'] = (bool) ( (trim($z06d4c['Reply']) != '') && ($z06d4c['IsReplyVisible']) ); if ((string)$z06d4c['Reply']!==''){ $o2bfe4=j154e($saad65['FormatterID'],$z06d4c['Reply'],'full'); $vc6827['reply']=$o2bfe4['text-final']; } if(array_key_exists('_',$z06d4c))$vc6827['_']=$z06d4c['_']; if(Log::$ned2b5)__log('Comments: done'); return $vc6827; } function q0d27($xb80bb){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". $xb80bb ."'" ); $cfa816=d0d6b(); if(count($cfa816) > 0){ return $cfa816[0]; } else { return false; } } function le5b6($p0604c){ e2_comment_set_flag('IsVisible',$p0604c); } function u3183($l0dd2c){ e2_comment_set_flag('IsReplyVisible',$l0dd2c); } function f66aa($oea59a){ global$_strings,$_config,$settings; $ye3cb9=@$_COOKIE[v8c3b('commenter_name')]; $yf92ee=@$_COOKIE[v8c3b('commenter_email')]; $c3d682=@$_COOKIE[v8c3b('commenter_ph')]; $p92399=false; if ($yf92ee and $c3d682){ foreach (pd225($oea59a) as $x39c63){ $e97f69=md5($x39c63['ID'].$x39c63['Stamp'] .'x'); if ( $x39c63['AuthorEmail']==$yf92ee and $c3d682==$e97f69 ){ $p92399=true; break; } } } $sc50d0=$_strings['fb--submit']; $l05fa8=gd8c5(); $b80f02=array ( '.note-id' => $oea59a['ID'], '.comment-id' => 'new', '.already-subscribed?' => (bool)$p92399, 'cookie-name' => n41f3($oea59a['ID']), 'cookie-value' => q7c9d(), 'email-field-name' => s2e04(), 'nospam-field-name-part-1' => substr($l05fa8,0,4), 'nospam-field-name-part-2' => substr($l05fa8,4), 'create:edit?' => true, 'form-action' => x83c8('e2s_comment_process'), 'submit-text' => $sc50d0, 'show-subscribe?' => (bool) !$p92399, 'subscribe?' => (bool)$p92399, 'subscription-status' => $p92399? $_strings['gs--you-are-already-subscribed']:'', 'name' => htmlspecialchars($ye3cb9,ENT_COMPAT,HSC_ENC), 'email' => htmlspecialchars($yf92ee,ENT_COMPAT,HSC_ENC), 'text' => htmlspecialchars($z06d4c['Text'],ENT_COMPAT,HSC_ENC), 'email-comments-enabled?' => empty ($settings['comments']['require_gip']), 'gips' => array (), ); $w73ce1=false; $mafda1=''; foreach(e2_list_gips() as $z48e15){ if (!is_file(SYSTEM_FOLDER .'gips/'. $z48e15 .'.json')) { continue; } $r2ce07=e2_is_logged_in($z48e15); $b80f02['gips'][$z48e15] = ( e2_get_gip_auth_url($z48e15) ); if ($r2ce07){ $w73ce1=true; $ja64f4=e2_get_gip_session($z48e15); $mafda1=$ja64f4['GIP']; $b80f02['name']=htmlspecialchars( $ja64f4['AuthorName'],ENT_COMPAT,HSC_ENC ); } } if (!$b80f02['email-comments-enabled?'] and !count($b80f02['gips'])) { return false; } $b80f02['email-comments-only?'] = (count($b80f02['gips']) === 0); $b80f02['logged-in?']=$w73ce1; $b80f02['logged-in-gip']=$mafda1; $b80f02['logout-url']=$w73ce1?x83c8('e2m_gip_sign_out', array('provider' => E2GIP::get_logout_key())) : ''; return $b80f02; } function i3ce7($y21158){ return nb23e($y21158,'`IsNew` = 1'); } function v254f($y21158){ return nb23e($y21158,'`IsVisible` = 1'); } function nb23e($y21158,$o56790){ global$_config; if (!is_numeric($y21158)) return 0; $jbc751=0; u0738( "SELECT count(*) ". "FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". $y21158 ." ". "AND (". $o56790. ")", 'count comments' ); $result=d0d6b(); $result=(int)$result[0]['count(*)']; $jbc751=$result; return (int)$jbc751; } function v2a6b(){ global$_config; if(Log::$ned2b5)__log('Count new comments'); $xe2942=0; $f7ec7e=''; $xe8fab=''; try { u0738( "SELECT `NoteID`, `Text` FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsNew`=1 ORDER BY `Stamp`", 'count new comments for author menu' ); $result=d0d6b(); $xe2942=count($result); if ($xe2942){ $y21158=$result[0]['NoteID']; $xe8fab=x83c8( 'e2m_note', array ('*note' => i4627($y21158)) ); } } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Could not count new comments or provide link to the latest one'); } return array ((int)$xe2942,$f7ec7e,$xe8fab); } function n70a7($y21158){ global$_config; if(Log::$ned2b5)__log('Comments: getting comments for note '. $y21158); u0738( "SELECT * FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". @$y21158." ". "ORDER BY `Stamp`", 'get comments including deleted' ); $result=d0d6b(); return$result; } function pd225($saad65,$rd1cc6=''){ global$_config; $d70a17="ORDER BY `ID` DESC"; $r2cb9d=$vaf67c=[]; u0738( "SELECT DISTINCT `ID`, `Text`, `IsSubscriber`, `IsVisible`, ". "`AuthorName`, `AuthorEmail`, `Stamp` ". "FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". @$saad65['ID'] ." ". "AND `IsSubscriber`=1 ". "AND `IsVisible`=1 ". "AND `AuthorEmail`!='". a7928($rd1cc6) ."' ". $d70a17, 'get subscribers by note' ); $result=d0d6b(); foreach($result as $x39c63){ if (!in_array($x39c63['AuthorEmail'],$vaf67c)) { $r2cb9d[] = $x39c63; } $vaf67c[] = $x39c63['AuthorEmail']; } return $r2cb9d; } function gb387($saad65,$f3f917=NOTE_COMMENTABLE_NOW){ global$settings,$_config; $mbdb20=true; if (@$settings['comments']['fresh_only']) if (isset ($_config['comment_freshness_days'])) if ($saad65['Stamp'] < time()-$_config['comment_freshness_days']*SECONDS_IN_A_DAY) $mbdb20=false; $tc770a=$saad65['IsCommentable']; if ($f3f917==NOTE_COMMENTABLE_NOW_CONDITIONALLY){ $tc770a=true; } return ( $saad65['IsPublished'] and yb44b($saad65) and $mbdb20 and $tc770a ); } function e2_commentrec_with_parameters_($parameters=array ()) { $w39a37=$parameters['*note']; $na5d49=n70a7($w39a37['ID']); $l4032b=@$na5d49[$parameters['comment-number']-1]; if ($l4032b){ $l4032b['noterec']=$w39a37; return $l4032b; } } function s1a90($z98ea6=''){ global$settings,$qcbcce,$_config,$_fp_error; $_fp_error=false; $o0d5f1=s2e04(); $y21158=$c69b97=$vb0689=$a0c83f=$a1cb25=''; if(array_key_exists('note-id',$_POST)) $y21158=trim(@$_POST['note-id']); if(array_key_exists('comment-id',$_POST)) $c69b97=trim(@$_POST['comment-id']); if(array_key_exists('comment-number',$_POST)) $ib1bc2=trim(@$_POST['comment-number']); if(array_key_exists('name',$_POST)) $vb0689=trim(@$_POST['name']); if(array_key_exists($o0d5f1,$_POST)) $a0c83f=trim(@$_POST[$o0d5f1]); if(array_key_exists('text',$_POST)) $a1cb25=trim(@$_POST['text']); $qe3a2d=m07e3('Comments'); if(stripos($qe3a2d['Collation'],'utf8mb4')!==0){ $vb0689=uff7c($vb0689); $a1cb25=uff7c($a1cb25); } if ($c69b97=='new'){ $k396a4=e2_get_logged_gip_name(); if ($k396a4){ $ja64f4=e2_get_gip_session($k396a4); $vb0689=trim($ja64f4['AuthorName']); $a0c83f=''; $idec42=$ja64f4['GIPAuthorID']; } } else { if(array_key_exists('gip',$_POST))$k396a4=trim(@$_POST['gip']); } $q07d3d=( (array_key_exists('already-subscribed',$_POST) and $_POST['already-subscribed']) or (array_key_exists('subscribe',$_POST) and $_POST['subscribe']) ); $u20612=time(); $x9d090['text']=$a1cb25; if ($c69b97=='new' and !$k396a4){ ic64a('commenter_name',$vb0689); ic64a('commenter_email',$a0c83f); } $n848b5=($c69b97=='new' and ( web9a() or e2_cookie_data_is_spam_suspicios_for_note_id_($y21158) )); $lc2b1a=1; $result=false; if (!is_numeric($y21158)) { $_fp_error=FP_NO_ID_OR_NEW; } elseif (!is_numeric($c69b97) and !($c69b97=='new')) { $_fp_error=FP_NO_ID_OR_NEW; } else { if ( $a1cb25=='' or ( !$k396a4 and ($vb0689=='' or $a0c83f=='') ) ) { $_fp_error=FP_EMPTY_FIELD; } if ($c69b97=='new'){ $y795f1=@unserialize(file_get_contents(USER_FOLDER. '/last-comment.psa')); if(md5($vb0689.$a0c83f.$a1cb25)==$y795f1['md5']) { $_fp_error=FP_COMMENT_DOUBLE_POST; } if ( isset ($_config['max_comment_length']) and strlen(@$_POST['text']) > ($_config['max_comment_length']) ){ $_fp_error=FP_COMMENT_TOO_LONG; } $w39a37=i4627($y21158); if ($c69b97=='new' and !gb387($w39a37)) { $_fp_error=FP_NOT_COMMENTABLE; } if ($n848b5){ $_fp_error=FP_COMMENT_SPAM_SUSPECT; } } } if (!$_fp_error){ e2_drop_caches_for_note_($y21158); if ($c69b97=='new'){ $l4032b=array ( 'NoteID' => (int)$y21158, 'AuthorName' => $vb0689, 'AuthorEmail' => $a0c83f, 'Text' => $a1cb25, 'Reply' => '', 'IsVisible' => 1, 'IsAnswerAware' => 1, 'IsSubscriber' => (int)$q07d3d, 'IsSpamSuspect' => (int)$n848b5, 'IsNew' => (int)$lc2b1a, 'Stamp' => (int)time(), 'LastModified' => (int)time(), 'IP' => a7928(p1668()), 'IsGIPUsed' => intval(!empty ($k396a4) && !empty ($idec42)), 'GIP' => !empty ($k396a4)?a7928($k396a4):'', 'GIPAuthorID' => !empty ($idec42)?a7928($idec42):'', ); $l4032b=v9943('Comments',$l4032b); $c69b97=$l4032b['ID']; $y795f1=array ( 'id' => $c69b97, 'md5' => md5($vb0689.$a0c83f.$a1cb25), ); @k6e52(USER_FOLDER. 'last-comment.psa',serialize($y795f1)); $result=(int)$c69b97; $h303ee=md5($l4032b['ID'].$l4032b['Stamp'].'x'); ic64a('commenter_ph',$h303ee); $saad65=i4627($y21158); $gd58c0=x83c8('e2m_note', array ('*note' => $saad65)); $vc6827['comment-time'] = array ($u20612,g5c05()); $vc6827['commenter']=$vb0689; $vc6827['commenter-email']=$a0c83f; $vc6827['comment-text']=$a1cb25; $vc6827['note-title']=$saad65['Title']; $vc6827['note-href']=$gd58c0; $vc6827['comment-href']=$gd58c0; $vc6827['comments-disable-href']=x83c8('e2m_note_flag', array ( '*note' => $saad65, 'flag' => 'IsCommentable', 'value' => 0 )); $vc6827['reply-href']=x83c8( 'e2m_comment_reply', array ( '*note' => $saad65, 'comment-number' => $ib1bc2 ) ); if (isset ($settings['user']['email']) and @$settings['notifications']['new_comments']) { $ade7a3=n3e5c( 'comment-new-to-author',$vc6827 ); $lb904c=e2l_get_string( 'em--comment-new-to-author-subject', $vc6827 ); $k77613=$settings['user']['email']; $q1a49b = 'From: '. daed2() ."\r\n". 'Reply-to: '. $vb0689 .' <'. $a0c83f .">"; fa41b($k77613,$lb904c,$ade7a3,$q1a49b); } if (!$n848b5){ unset ($vc6827['commenter-email']); $q1a49b='From: '. daed2(); foreach (pd225($saad65,$a0c83f) as $x39c63){ $aba570=$x39c63['AuthorEmail']; $h6fd85=md5($x39c63['ID'].$x39c63['Stamp'].'x'); $vc6827['unsubscribe-href']=x83c8('e2m_unsubscribe', array ( '*note' => $saad65, 'unsubscribe-email' => $aba570, 'unsubscribe-key' => $h6fd85 ) ); $k77613=$aba570; $ade7a3=n3e5c('comment-new-to-public',$vc6827); $lb904c=e2l_get_string( 'em--comment-new-to-public-subject', $vc6827 ); fa41b($k77613,$lb904c,$ade7a3,$q1a49b); } } } else { $ffd6f3=array ( 'ID' => $c69b97, 'Text' => $a1cb25, 'IsSubscriber' => ((int)$q07d3d), 'LastModified' => time(), ); if (!empty ($vb0689))$ffd6f3['AuthorName']=$vb0689; if (!empty ($a0c83f))$ffd6f3['AuthorEmail']=$a0c83f; qaa79('Comments',$ffd6f3); $result=(int)$c69b97; } } if ($z98ea6=='ajaxresult') return $w1fa03; else return array ((int)$y21158,$result,$x9d090); } function e2m_most_commented(){ global$settings,$_strings,$_config; $za0acf=@$_GET['period']; if ($za0acf=='')$za0acf=$_config['hot_period']; $u632a2=time()-f35c3($za0acf); return xd864(array ( 'query' => "SELECT `IsVisible`, `Stamp`, `NoteID` ID, count(*) quantity ". "FROM `". $_config['db_table_prefix']."Comments` c ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (`Stamp` > ". $u632a2.") ". "AND c.`IsVisible` = 1 ". "GROUP BY ID ". "ORDER BY quantity ". "DESC ". "LIMIT ".$settings['appearance']['notes_per_page'], 'query-returns-only-ids' => 1, 'limit' => $settings['appearance']['notes_per_page'], 'title' => e2l_get_string('pt--most-commented', array ('period' => $za0acf)), 'heading' => e2l_get_string('pt--most-commented', array ('period' => $za0acf)), 'nothing' => $_strings['gs--no-such-notes'], )); } function e2m_favourites($parameters=array ()) { global$_config,$_strings; return xd864(array ( 'query' => "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 AND `IsFavourite`=1 ". w6f32(we852()). "ORDER BY `Stamp` DESC", 'page' => $parameters['page'], 'candy' => 'e2m_favourites', 'parameters' => $parameters, 'title' => $_strings['pt--favourites'], 'heading' => $_strings['pt--favourites'], 'nothing' => $_strings['gs--no-favourites'], )); } function f35c3($za0acf){ if ('year'==$za0acf) return SECONDS_IN_A_YEAR; elseif ('month'==$za0acf) return SECONDS_IN_A_MONTH; elseif ('week'==$za0acf) return SECONDS_IN_A_DAY*7; elseif ('day'==$za0acf) return SECONDS_IN_A_DAY; else return PHP_INT_MAX; } function h8696($s8d777){ global$_current_url; if(Log::$ned2b5)__log('Arbitrary list ('. $s8d777['_log'] .') {'); $of4ac8=null; if ($s8d777['cache'] and is_file($s8d777['cache-filename'])) { $of4ac8=@unserialize(file_get_contents($s8d777['cache-filename'])); } $tf957e=true; if ($s8d777['cache-filename-expires']) { if ($s8d777['cache'] and is_file($s8d777['cache-filename-expires'])) { $g07cc6=time(); $k09bcb=(int) @file_get_contents($s8d777['cache-filename-expires']); if(Log::$ned2b5)__log('List expires '. date('r',$k09bcb) .', now '. date('r',$g07cc6)); $tf957e=($g07cc6 < $k09bcb); } } $udbb0c=array(); if ($s8d777['cache'] and is_array($of4ac8) and $tf957e){ if(Log::$ned2b5)__log('Retrieve cached ctree'); $udbb0c=$of4ac8; } else { if(Log::$ned2b5)__log('Assemle cacheable ctree...'); $z4358b=array(); try { u0738( $s8d777['query'], 'get "'. $s8d777['_log'] .'" list' ); $result=d0d6b(); foreach($result as $d8ce4b => $w39a37){ $w39a37=i4627($w39a37['ID']); if (yb44b($w39a37) and $w39a37['IsPublished']) { $saad65['_']['_id']=$w39a37['ID']; $saad65['_']['_ord']=$d8ce4b; $saad65['_']['_ord_max']=count($result)-1; $saad65['href']=x83c8('e2m_note', array ('*note' => $w39a37)); $saad65['time'] = array ($w39a37['Stamp'],l0923($w39a37)); $saad65['title']=u6f10(htmlspecialchars($w39a37['Title'],ENT_NOQUOTES,HSC_ENC)); $udbb0c[] = $saad65; } } $of4ac8=$udbb0c; if ($s8d777['cache']) { @k6e52($s8d777['cache-filename'],serialize($of4ac8)); if ($s8d777['cache-filename-expires']) { @k6e52($s8d777['cache-filename-expires'],time()+$s8d777['expires-after']); } } } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Could not get arbitrary list from database'); } } foreach ($udbb0c as $d8ce4b => $t9e366){ $udbb0c[$d8ce4b]['current?'] = ($udbb0c[$d8ce4b]['href']==$_current_url); } if(Log::$ned2b5)__log('}'); return $udbb0c; } function we9f2(){ global$_config; $u632a2=time()-f35c3($_config['popular_period']); return h8696(array ( '_log' => 'most_read', 'cache' => CACHE_POPULAR, 'cache-filename' => CACHE_FILENAME_POPULAR, 'cache-filename-expires' => CACHE_FILENAME_POPULAR_EXPIRES, 'expires-after' => SECONDS_IN_A_DAY, 'query' => ( "SELECT n.`ID`, n.`Title`, n.`IsFavourite`, ". "a.`EntityID`, SUM(a.`ReadCount`) ReadCount ". "FROM `". $_config['db_table_prefix']."Actions` a, ". "`". $_config['db_table_prefix']."Notes` n  ". "WHERE a.`SubsetID`=". $_config['db_table_subset'] ." ". "AND n.`SubsetID`=". $_config['db_table_subset'] ." ". "AND a.`Stamp` > ". $u632a2 ." ". "AND n.`IsPublished` = 1 ". w6f32(we852()). "AND a.`EntityID` = n.`ID` ". "GROUP BY a.`EntityID` ". "ORDER BY `IsFavourite` DESC, ReadCount DESC ". "LIMIT 10" ), )); } function o7f52(){ global$_strings; $oe292c=[ 'title' => $_strings['nm--most-read'], ]; $oe292c['each']=we9f2(); if(count($oe292c['each']) < 10) unset ($oe292c['each']); return $oe292c; } function e2m_password_reset(){ global$_strings,$_superconfig,$settings; if (!is_file(USER_FOLDER. 'password-reset.psa')) { $b3c6e0=sha1(rand()); $t572d4=x83c8('e2m_password', array ('recovery-key' => $b3c6e0)); @k6e52(USER_FOLDER. 'password-reset.psa',$t572d4); } $r2cb9d['title']=$_strings['pt--password-reset']; $r2cb9d['heading']=$_strings['pt--password-reset']; $d5bef8=(bool) ($k77613=$settings['user']['email']); $r2cb9d['form']='form-password-reset-email'; $r2cb9d['form-password-reset-email'] = array ( 'form-action' => x83c8('e2s_password_reset_email'), 'show-controls?' => $d5bef8, 'submit-text' => $_strings['fb--send-link-by-email'], ); if (!@$_superconfig['user_has_no_access_to_files']) { $r2cb9d['form-password-reset-email']['reset-info']=$_strings['gs--password-reset-link-saved']; } elseif (!$d5bef8){ q8a40($_strings['er--cannot-reset-password']); } return $r2cb9d; } function e2s_password_reset_email(){ global$_strings,$settings; if($_SERVER['REQUEST_METHOD']!='POST') return e2_go_to(); if(array_key_exists('email',$_POST))$a0c83f=trim($_POST['email']); if (!$a0c83f){ q8a40($_strings['er--cannot-send-link-email-empty']); e2_go_to(x83c8('e2m_password_reset')); die; } $v22207=@file_get_contents(USER_FOLDER. 'password-reset.psa'); if(strlen($v22207)==0){ q8a40($_strings['er--error-occurred']); e2_go_to(x83c8('e2m_password_reset')); die; } if ($k77613=$settings['user']['email']) { if ($a0c83f==$k77613){ $ade7a3=n3e5c( 'password-reset', array ('reset-href' => $v22207) ); $lb904c=$_strings['em--password-reset-subject']; $q1a49b='From: '. daed2(); fa41b($k77613,$lb904c,$ade7a3,$q1a49b); } q8a40($_strings['gs--password-reset-link-sent-maybe'],E2E_MESSAGE); e2_go_to(x83c8('e2m_password_reset')); die; } die; } function e2m_password($parameters){ global$settings,$_strings; $n2d832=false; $b3c6e0=''; if(array_key_exists('recovery-key',$parameters)) { $b3c6e0=$parameters['recovery-key']; $t572d4=x83c8('e2m_password', array ('recovery-key' => $b3c6e0)); $v22207=@file_get_contents(USER_FOLDER. 'password-reset.psa'); if(strlen($v22207) > 0){ $n2d832=($t572d4==$v22207); } } if (we852() or $n2d832){ $r2cb9d['title']=$_strings['pt--password']; $r2cb9d['heading']=$_strings['pt--password-for-blog']; if ($n2d832){ $r2cb9d['title']=$_strings['pt--password-reset']; $r2cb9d['heading']=$_strings['pt--password-reset']; } $r2cb9d['form']='form-password'; $r2cb9d['form-password'] = array ( 'form-action' => x83c8('e2s_password_save'), '.recovery-key' => $b3c6e0, 'recovering?' => $n2d832, 'submit-text' => $_strings['fb--change'], ); return $r2cb9d; } else { e2_go_to(); } } function e2m_sessions(){ global$settings,$_strings; $t2d6d8=j7785(); $r2cb9d['title']=$_strings['pt--sessions']; $r2cb9d['heading']=$_strings['pt--sessions']; $c161bc=array(); $b3c6e0=$_COOKIE[v8c3b('key')]; foreach ($t2d6d8['sessions'] as $d8ce4b => $t9e366){ $c161bc[] = array ( 'current?' => sha1($b3c6e0)===$t9e366['key_hash'], 'opened' => array ((int)$t9e366['stamp'],j3211()), 'ip-address' => $t9e366['remote_ip'], 'source' => ($t9e366['remote_ip']=='127.0.0.1')? $_strings['gs--locally']:$t9e366['remote_ip'], 'title' => hcc31($t9e366['ua']), 'user-agent' => $t9e366['ua']? $t9e366['ua']:$_strings['gs--unknown'], ); } $c161bc=array_reverse($c161bc); $r2cb9d['sessions']['each']=$c161bc; if(count($c161bc) > 1){ $r2cb9d['form']='form-sessions'; $r2cb9d['form-sessions'] = array ( 'form-action' => x83c8('e2s_drop_other_sessions'), 'submit-text' => $_strings['fb--end-all-sessions-but-this'], ); } return $r2cb9d; } function e2m_sign_in(){ if (we852()) { e2_go_to(x83c8('e2m_frontpage', array ('page' => 1))); } else { return array (); } } function e2m_sign_out(){ global$_strings; $t2d6d8=j7785(); $k48bb9=-1; if(array_key_exists('sessions',$t2d6d8) and is_array($t2d6d8['sessions'])) { foreach ($t2d6d8['sessions'] as $d8ce4b => $t9e366){ $b3c6e0=$_COOKIE[v8c3b('key')]; if(sha1($b3c6e0)===$t9e366['key_hash']) { $k48bb9=$d8ce4b; break; } } } if ($k48bb9 > -1) unset ($t2d6d8['sessions'][$k48bb9]); if (!z1d21($t2d6d8)) { q8a40($_strings['er--cannot-write-auth-data'],E2E_PERMISSIONS_ERROR); } ic64a('key',''); e2_go_to(); die; } function e2s_password_save(){ global$settings,$_strings; $n2d832=false; $z0512f=trim($_POST['old-password']); if ($b3c6e0=trim($_POST['recovery-key'])) { $t572d4=x83c8('e2m_password', array ('recovery-key' => $b3c6e0)); $v22207=@file_get_contents(USER_FOLDER. 'password-reset.psa'); if(strlen($v22207) > 0){ $n2d832=($t572d4==$v22207); } } if (ka8cf($z0512f) or $n2d832){ $u88162=trim($_POST['new-password']); if ($u88162!=''){ if (@k6e52(USER_FOLDER. '/password-hash.psa',serialize(sha1($u88162)))) { @unlink(USER_FOLDER. 'password-reset.psa'); q8a40($_strings['gs--password-changed'],E2E_MESSAGE); e2_go_to(); } else { q8a40($_strings['er--could-not-change-password'],E2E_PERMISSIONS_ERROR); e2_go_to(x83c8('e2m_password', array ('recovery-key' => ''))); } } else { q8a40($_strings['er--no-password-entered'],E2E_USER_ERROR); e2_go_to(x83c8('e2m_password', array ('recovery-key' => ''))); } } else { q8a40($_strings['er--wrong-password'],E2E_USER_ERROR); e2_go_to(x83c8('e2m_password', array ('recovery-key' => ''))); } die; } function e2s_sign_in_necessary(){ e2_go_to(x83c8('e2m_sign_in')); die; } function p1668(){ $r957b5=$_SERVER['REMOTE_ADDR']; if(array_key_exists('HTTP_X_FORWARDED_FOR',$_SERVER)) { $r957b5=array_pop(explode(',',$_SERVER['HTTP_X_FORWARDED_FOR'])); } return $r957b5; } function e2s_sign_in(){ global$_strings; $t2d6d8=j7785(); if($_SERVER['REQUEST_METHOD']=='POST'){ $g5f4dc=@$_POST['password']; $p6bc8e=@$_POST['is_public_pc']; } else { $g5f4dc=@$_GET['password']; $p6bc8e=false; } if (ka8cf($g5f4dc)) { @unlink(USER_FOLDER. 'password-reset.psa'); $u21d6f=array ( 'stamp' => time(), 'remote_ip' => p1668(), 'key_hash' => qe8ed($p6bc8e), 'ua' => $_SERVER['HTTP_USER_AGENT'], ); $t2d6d8['sessions'][] = $u21d6f; } elseif(strlen(trim($g5f4dc)) > 0){ ja711(); q8a40($_strings['er--wrong-password'],E2E_USER_ERROR); } if (!z1d21($t2d6d8)) { q8a40($_strings['er--cannot-write-auth-data'],E2E_PERMISSIONS_ERROR); e2_go_to(); die; } j4930(); die; } function e2s_drop_other_sessions(){ global$_strings; $t2d6d8=j7785(); foreach ($t2d6d8['sessions'] as $d8ce4b => $t9e366){ $b3c6e0=$_COOKIE[v8c3b('key')]; if(sha1($b3c6e0)===$t9e366['key_hash']) { $u21d6f=$t9e366; break; } } $t2d6d8['sessions'] = array ($u21d6f); if (!z1d21($t2d6d8)) { q8a40($_strings['er--cannot-write-auth-data'],E2E_PERMISSIONS_ERROR); } j4930(); die; } function ka8cf($g5f4dc){ $a8e9a8=@unserialize(file_get_contents(USER_FOLDER. '/password-hash.psa')); return (sha1($g5f4dc)===$a8e9a8 and trim($g5f4dc)!=''); } function qe8ed($s2a2a4=false){ global$settings; $b3c6e0=q2a24(); $c3f363=sha1($b3c6e0); ic64a('key',$b3c6e0, !$s2a2a4); return $c3f363; } function we852(){ global $e1c0b7,$settings,$_auth_sessions; if (isset ($e1c0b7)) return $e1c0b7; $e1c0b7=false; if (isset ($_COOKIE[v8c3b('key')])) { $b3c6e0=$_COOKIE[v8c3b('key')]; $t2d6d8=j7785(); $e0f83b=array(); if(array_key_exists('sessions',$t2d6d8) and is_array($t2d6d8['sessions'])) { foreach ($t2d6d8['sessions'] as $u21d6f){ $e0f83b[] = $u21d6f['key_hash']; } $_auth_sessions['count']=count($t2d6d8['sessions']); } if(1){ $e1c0b7=(bool)in_array(sha1($b3c6e0),$e0f83b,true); } if (!$e1c0b7){ ic64a('key',''); } } return $e1c0b7; } function j7785(){ if(is_file(USER_FOLDER.'auth.psa')) { $t2d6d8=unserialize(@file_get_contents(USER_FOLDER.'auth.psa')); if ($t2d6d8) return $t2d6d8; } return array (); } function z1d21($t2d6d8){ return k6e52(USER_FOLDER.'auth.psa',serialize($t2d6d8)); } function pc3fb(){ if ($b3c6e0=$_COOKIE[v8c3b('key')]) { return v8c3b('key') .'='. $b3c6e0 .""; } } function zff2e(){ if ($b3c6e0=$_COOKIE[v8c3b('key')]) { return 'Cookie: '. v8c3b('key') .'='. $b3c6e0 ."\r\n"; } return "\r\n"; } function hcc31($y5269f){ global$_strings; if(strstr($y5269f,'iPhone')) return$_strings['gs--ua-iphone']; if(strstr($y5269f,'iPad')) return$_strings['gs--ua-ipad']; if(strstr($y5269f,'Opera'))$r2cb9d=$_strings['gs--ua-opera']; if(strstr($y5269f,'Firefox'))$r2cb9d=$_strings['gs--ua-firefox']; if(strstr($y5269f,'Chrome'))$r2cb9d=$_strings['gs--ua-chrome']; if(strstr($y5269f,'Safari') and !strstr($y5269f,'Chrome'))$r2cb9d=$_strings['gs--ua-safari']; if (!$r2cb9d)$r2cb9d=$_strings['gs--ua-unknown']; if(strstr($y5269f,'Macintosh')) { if ($r2cb9d)$r2cb9d.=' '. $_strings['gs--ua-for-mac']; } return $r2cb9d; } function e2j_check_password(){ $a8e9a8=@unserialize(file_get_contents(USER_FOLDER. '/password-hash.psa')); $g5f4dc=''; if(array_key_exists('password',$_POST))$g5f4dc=$_POST['password']; ja711(); $gd1fc8=[ 'success' => true, 'data' => [ 'password-correct' => trim($g5f4dc)!=='' and sha1($g5f4dc)===$a8e9a8 ], ]; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } function q2a24(){ $eb04ec=''; $gb8d1b='0123456789abcdef'; for ($f865c0=0; $f865c0 < 40; $f865c0++)$eb04ec.=$gb8d1b[mt_rand(0,15)]; $eb04ec.=time(); $eb04ec=sha1($eb04ec); return $eb04ec; } function ja711(){ if(is_file(USER_FOLDER. 'password-wait.psa')) { $waf788=unserialize( file_get_contents(USER_FOLDER. '/password-wait.psa') ); if ($waf788['delay'] < 5){ $waf788['delay'] ++; } if(time()-$waf788['time'] > SECONDS_IN_A_MINUTE){ $waf788['delay']=0; } $waf788['time']=time(); } else { $waf788=array ( 'time' => time(), 'delay' => 5, ); } k6e52(USER_FOLDER.'password-wait.psa',serialize($waf788)); sleep($waf788['delay']); } function i7874(){ static $e34e51; if(empty($e34e51))$e34e51=md5('seret'); return $e34e51; } function n1305($fb45cf){ $b3c6e0=i7874(); $o16ec1=strlen($b3c6e0); $h2db95=strlen($fb45cf); $r2cb9d=''; for ($f865c0=0; $f865c0 < $h2db95+rand(16,64); ++ $f865c0){ if ($f865c0 > $h2db95){ $t462e1=rand(0,127); } elseif ($f865c0==$h2db95){ $t462e1=0; } else { $t462e1=ord($fb45cf[$f865c0]); } $b18e1b=chr(($t462e1+ord($b3c6e0[$f865c0%$o16ec1])) % 256); $r2cb9d.=$b18e1b; } $r2cb9d=base64_encode($r2cb9d); return $r2cb9d; } function iee85($fb45cf){ $b3c6e0=i7874(); $o16ec1=strlen($b3c6e0); $fb45cf=base64_decode($fb45cf); $h2db95=strlen($fb45cf); $r2cb9d=''; for ($f865c0=0; $f865c0 < $h2db95; ++ $f865c0){ $ld9468=(ord($fb45cf[$f865c0]) + 256-ord($b3c6e0[$f865c0%$o16ec1])) % 256; if ($ld9468===0) break; $r2cb9d.=chr($ld9468); } return $r2cb9d; } function c126f(){ global$settings; if (we852()) { return []; } else { return [ 'form-action' => x83c8('e2s_sign_in'), 'form-check-password-action' => x83c8('e2j_check_password'), 'login-name' => @$settings['author'], 'public-pc?' => false, 'reset-href' => x83c8('e2m_password_reset'), ]; } } $_candies_installer=array ( 'e2s_build', 'e2m_info', 'e2m_install', 'e2j_check_db_config', 'e2j_list_databases', 'e2s_instantiate', 'e2s_install', 'e2s_update_perform', ); $_candies_public=array ( 'e2m_info', 'e2m_frontpage', 'e2m_rss', 'e2m_json', 'e2m_note', 'e2m_note_json', 'e2m_note_read', 'e2m_draft_preview', 'e2m_tags', 'e2m_tag', 'e2m_tag_rss', 'e2m_tag_json', 'e2m_favourites', 'e2m_most_commented', 'e2m_found', 'e2m_comments', 'e2m_everything', 'e2m_sitemap_xml', 'e2m_year', 'e2m_month', 'e2m_day', 'e2m_unsubscribe', 'e2m_theme_preview', 'e2m_password_reset', 'e2s_password_reset_email', 'e2m_password', 'e2s_password_save', 'e2s_sign_in', 'e2m_sign_out', 'e2m_gip_sign_in', 'e2m_gip_sign_in_callback', 'e2m_gip_sign_out', 'e2s_comment_process', 'e2s_search', 'e2s_bsi_step', 'e2j_check_password', 'e2s_notify', ); $_candies_to_disallow_in_read_only=array ( 'e2m_write', 'e2m_note_edit', 'e2s_note_process', 'e2s_note_publish', 'e2s_note_delete', 'e2m_note_flag_favourite', 'e2m_note_flag', 'e2m_comment_edit', 'e2m_comment_delete', 'e2m_comment_reply', 'e2m_comment_reply_delete', 'e2m_comment_flag', 'e2m_comment_flag_ajax', 'e2m_unsubscribe', 'e2s_comment_process', 'e2m_settings', 'e2m_timezone', ); $_candies_public=array_merge($_candies_public,$_candies_installer); $_candies_indexable=array ( 'e2m_note', ); $_candies_indexable_conditionally=array ( 'e2m_frontpage', 'e2m_tag', 'e2m_favourites', 'e2m_most_commented', 'e2m_found', 'e2m_tags', 'e2m_everything', ); $_candies_ajax=array ( 'e2j_check_db_config', 'e2j_list_databases', 'e2j_check_password', 'e2j_userpic_upload', 'e2j_userpic_remove', 'e2j_file_upload', 'e2j_file_remove', 'e2j_note_livesave', 'e2m_note_flag_favourite', 'e2m_comment_flag_ajax', 'e2m_tag_flag_ajax', ); function t3020(){ global$settings,$_lang,$_config,$_strings,$ra57c1; if(Log::$ned2b5)__log('Blog information'); $m126ac['author']=htmlspecialchars(k2640(),ENT_NOQUOTES,HSC_ENC); if(array_key_exists('description',$settings)) { $o2bfe4=bb7f1($settings['description'],'full'); $f67daf=$o2bfe4['text-final']; $m126ac['description']=$f67daf; $m126ac['description-format-info']=$o2bfe4['meta']; a57ad(@$o2bfe4['meta']['links-required']); } $m126ac['title']=htmlspecialchars(n6f51(),ENT_NOQUOTES,HSC_ENC); $m126ac['userpic-set?']=false; $m126ac['userpic-changeable?']=we852(); if ($m126ac['userpic-href']=f2461()) { $m126ac['userpic-set?']=true; $m126ac['userpic-large-href']=f2461('large'); $m126ac['userpic-square-href']=f2461('square'); $m126ac['userpic-changeable-href']=$m126ac['userpic-href']; } else { unset ($m126ac['userpic-href']); } if (we852()) { $m126ac['userpic-upload-action']=x83c8('e2j_userpic_upload'); $m126ac['userpic-remove-action']=x83c8('e2j_userpic_remove'); } $m126ac['href']=x83c8('e2m_frontpage', array ('page' => 1)); $m126ac['rss-href']=x83c8('e2m_rss'); $m126ac['jsonfeed-href']=x83c8('e2m_json'); $m126ac['language']=$_lang; $m126ac['show-subscribe-button?']=false; $l97bc5=array (time(),g5c05()); $a5f36b=qa846('Y',$l97bc5[0]); $m126ac['now']=$l97bc5; $faa103=$a5f36b; $a33b09=lcc02('start'); if(array_key_exists('stamp',$a33b09)) { $faa103=qa846('Y',$a33b09['stamp']); $m126ac['start-time'] = array ((int)$a33b09['stamp'],$a33b09['timezone']); } $bd0a87=false; $k40d73=u3456(true,true); if ($k40d73!==null){ if (we852()) { $fa4f0c=u3456(true,false); if ($fa4f0c!==null){ $bd0a87=($k40d73+$fa4f0c==0); } } else { $bd0a87=($k40d73==0); } } $m126ac['notes-count'] = (int)$k40d73; $m126ac['virgin?']=$bd0a87; $j9fbfe=$_config['years_range_separator']? $_config['years_range_separator']:$_strings['gs--range-separator']; $m126ac['years-range']=$faa103 . (($faa103==$a5f36b)? '':($j9fbfe.$a5f36b)); if ($ra57c1){ $m126ac['parent-site-href']=substr($ra57c1, (int)strpos('/',$ra57c1)); } return $m126ac; } function n6f51(){ global$settings,$_strings; if ( array_key_exists('site_title',$settings) and trim($settings['site_title']) != '' ){ return trim($settings['site_title']); } else { return$_strings['e2--default-blog-title']; } } function k2640(){ global$settings,$_strings; if ( array_key_exists('author',$settings) and trim($settings['author']) != '' ){ return trim($settings['author']); } else { return$_strings['e2--default-blog-author']; } } function f2461($size=''){ global$full_blog_url; if (!is_file($j435ed=USER_FOLDER .'[email protected]')) { if (!is_file($j435ed=USER_FOLDER .'[email protected]')) { return false; } } if($size=='large' and is_file(USER_FOLDER .'[email protected]')) { $j435ed=USER_FOLDER .'[email protected]'; } if($size=='square' and is_file(USER_FOLDER .'[email protected]')) { $j435ed=USER_FOLDER .'[email protected]'; } $jbc7b3=stat($j435ed); if ($jbc7b3['mtime']) { $j435ed.='?'. $jbc7b3['mtime']; } $mc315c=$full_blog_url .'/'. $j435ed; return $mc315c; } function l6442(){ global$_config,$_stopwatch,$k11755; $yc8542=round(v7f78()-$_stopwatch,3); return [ 'show?' => ($_config['display_stat'] > (int) !we852()), 'generation-time' => str_replace('.',',',$yc8542), 'peak-memory-mb' => str_replace('.',',',round((memory_get_peak_usage()/1024/1024)*100)/100), 'db-query-count' => (int) @$k11755, ]; } function e2m_info(){ global$settings,$_config,$x57de2,$ra57c1,$_template; $cf1f71=array ( 'E2_VERSION' => E2_VERSION, 'E2_RELEASE' => E2_RELEASE, 'E2_UA_STRING' => E2_UA_STRING, '---', 'PHP_VERSION' => PHP_VERSION, '---', 'installed' => (n2ac5()!==null), 'server_name' => $x57de2, 'folder_on_server' => $ra57c1, '---', 'default formatter' => $_config['default_formatter'], '---', 'theme' => $settings['template'], '---', 'Olba name' => $_template['name'], 'Olba max_image_width' => $_template['max_image_width'], 'Olba stack' => $_template['stack'], '---', 'Neasden' => substr(md5(file_get_contents('system/neasden/neasden.php')), 0,4), '---', ); echo '<pre>'; foreach ($cf1f71 as $d8ce4b => $t9e366){ if ($t9e366=='---'){ echo "\n"; continue; } echo str_pad($d8ce4b,24); echo '\''; print_r($t9e366); echo '\''; echo "\n"; } echo '</pre>'; die; } function e2s_notify(){ global$_config; if($_config['holborn']) { $w4de32=@$_GET['src']; if ($w4de32==''){ if(Log::$ned2b5)__log('Holborn: No src URL'); die; } $z466de=file_get_contents($w4de32); $z466de=n09a6($z466de); $ae13b0=json_decode($z466de,true); if (!$ae13b0){ if(Log::$ned2b5)__log('Holborn: No meaningful info from '. $w4de32 .' ('. json_last_error() .')'); if ($i13bc3=vdd69($w4de32)) { if(Log::$ned2b5)__log('Holborn: Delete note with ID '. $i13bc3['ID']); le268($i13bc3['ID']); } die; } m927d($ae13b0,$w4de32); } die; } function e2m_sources($parameters){ global$_config; $b8bef1=$_GET['ord']; if (!$b8bef1)$b8bef1='ID'; $b8bef1="`". a7928($b8bef1) ."`"; u0738( "SELECT *, REPLACE(REPLACE(REPLACE(`URL`, 'http://', ''), 'https://', ''), 'www.', '') AS _URLX ". "FROM `". $_config['db_table_prefix']."Sources` " . "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "ORDER BY ". $b8bef1 ); $result=d0d6b(); foreach($result as $r447b7){ $nc615c=$r447b7['ID']; if ($r447b7['ID']!=$r447b7['TrueID'])$nc615c.='<br />'. $r447b7['TrueID']; $h36cd3=array ( 'id' => $nc615c, 'userpic-href' => $r447b7['PictureURL'], 'href' => $r447b7['URL'], 'href-display' => str_replace('/','/<wbr>',$r447b7['URL']), 'href-filtered' => str_replace('/','/<wbr>',$r447b7['_URLX']), 'title' => $r447b7['Title'], 'author' => $r447b7['AuthorName'], 'true?' => $r447b7['ID']==$r447b7['TrueID'], 'whitelisted?' => $r447b7['IsWhiteListed'], 'trusted?' => $r447b7['IsTrusted'], ); if (!$r447b7['IsTrusted']) { $h36cd3['trust-url']=x83c8( 'e2m_source_trust', array ('source' => $r447b7['ID']) ); } if ($r447b7['IsTrusted']) { $h36cd3['premoderate-url']=x83c8( 'e2m_source_premoderate', array ('source' => $r447b7['ID']) ); } $h36cd3['ban-url']=x83c8( 'e2m_source_ban', array ('source' => $r447b7['ID']) ); $h36cd3['forget-url']=x83c8( 'e2m_source_forget', array ('source' => $r447b7['ID']) ); $ff2ab5[] = $h36cd3; } $r2cb9d=array ( 'title' => 'Sources', 'heading' => 'Sources', ); if(count($ff2ab5)) { $r2cb9d['sources']=$ff2ab5; } else { $r2cb9d['nothing']='No sources'; } return $r2cb9d; } function e2m_source_trust($parameters){ global$_config; $d0afd9=$parameters['source']; u0738( "UPDATE  ". $_config['db_table_prefix']."Sources ". "SET `IsWhitelisted`=1, `IsTrusted`=1 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $d0afd9, 'trust source' ); u0738( "UPDATE  ". $_config['db_table_prefix']."Notes ". "SET `IsPublished`=1 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `SourceID`=". $d0afd9, 'publish all notes from the just trusted source' ); c198f(); i7996(); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); e2_go_to(''); die; } function e2m_source_premoderate($parameters){ global$_config; $d0afd9=$parameters['source']; u0738( "UPDATE  ". $_config['db_table_prefix']."Sources ". "SET `IsTrusted`=0 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $d0afd9, 'distrust source, set to premoderation' ); i7996(); e2_go_to(''); die; } function e2m_source_ban($parameters){ global$_config; $d0afd9=$parameters['source']; u0738( "UPDATE  ". $_config['db_table_prefix']."Sources ". "SET `IsWhiteListed`=0, `IsTrusted`=0 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $d0afd9, 'ban source' ); u0738( "DELETE FROM  ". $_config['db_table_prefix']."Notes ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `SourceID`=". $d0afd9, 'delete all notes from the just banned source' ); i7996(); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); e2_go_to(''); die; } function e2m_source_forget($parameters){ global$_config; $d0afd9=$parameters['source']; u0738( "DELETE FROM  ". $_config['db_table_prefix']."Sources ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $d0afd9, 'forget source' ); u0738( "DELETE FROM  ". $_config['db_table_prefix']."Notes ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `SourceID`=". $d0afd9, 'delete all notes from the just forgotten source' ); i7996(); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); e2_go_to(''); die; } function m927d($na7251,$w4de32){ if(Log::$ned2b5)__log('Holborn: Note info == '. print_r($na7251,true)); $va4a84=k10cd(array ( 'author' => $na7251['author']['name'], 'title' => $na7251['title'], 'href' => $na7251['author']['url'], 'userpic-href' => $na7251['author']['avatar'], )); if (!$va4a84['IsWhiteListed']) return; if(preg_match('/\+(\d\d)\:(\d\d)/',$na7251['items'][0]['date_published'],$j9c28d)) { $v7a86c=$j9c28d[1]*SECONDS_IN_AN_HOUR+$j9c28d[2]*SECONDS_IN_A_MINUTE; } $a929cf=@$na7251['items'][0]['_e2_data'] or $a929cf=array(); $a929cf=json_encode($a929cf); $w39a37=array ( 'Title' => $na7251['items'][0]['title'], 'Text' => $na7251['items'][0]['content_html'], 'FormatterID' => 'raw', 'OriginalAlias' => '', 'Uploads' => '', 'Stamp' => strtotime($na7251['items'][0]['date_published']), 'Offset' => (int)$v7a86c, 'IsDST' => 0, 'LastModified' => strtotime($na7251['items'][0]['date_modified']), 'IsCommentable' => 0, 'IsPublished' => $va4a84['IsTrusted'], 'IsExternal' => 1, 'SourceID' => $va4a84['ID'], 'SourceNoteID' => $na7251['items'][0]['id'], 'SourceNoteURL' => $na7251['items'][0]['url'], 'SourceNoteJSONURL' => $w4de32, 'SourceNoteData' => $a929cf, ); $y21158=$na7251['items'][0]['id']; if ( $i13bc3=df25e($va4a84['ID'],$y21158) ) { $w39a37['ID']=$i13bc3['ID']; qaa79('Notes',$w39a37); } else { $w39a37=v9943('Notes',$w39a37); } if (vd2e1($w39a37)) { $w39a37['IsIndexed']='1'; qaa79('Notes',$w39a37); } e2_drop_caches_for_note_($w39a37['ID']); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); } function vdd69($w4de32){ global$_config; u0738( "SELECT `ID` FROM ". $_config['db_table_prefix']."Notes ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `SourceNoteJSONURL`='". $w4de32 ."' ". "LIMIT 1", 'get note ID by source JSON URL' ); $result=d0d6b(); return$result[0]; } function df25e($d0afd9,$ibb971){ global$_config; u0738( "SELECT `ID` FROM ". $_config['db_table_prefix']."Notes ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `SourceID`= '". $d0afd9 ."' ". "AND `SourceNoteID`= '". $ibb971 ."' ". "LIMIT 1", 'get note ID by source ID and source note ID' ); $result=d0d6b(); return$result[0]; } function n09a6($z466de){ for ($f865c0=0; $f865c0 <= 31; ++$f865c0){ $z466de=str_replace(chr($f865c0),'',$z466de); } $z466de=str_replace(chr(127),'',$z466de); if(0===strpos(bin2hex($z466de),'efbbbf')) { $z466de=substr($z466de,3); } return $z466de; } function k10cd($x03396){ global$_config; $m305c2=false; u0738( "SELECT * FROM ". $_config['db_table_prefix']."Sources ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `URL`= '". $x03396['href'] ."' ". "LIMIT 1", 'get source record by the URL from blog info' ); $result=d0d6b(); if(count($result)) { $m305c2=$result[0]; if ($m305c2['ID']!=$m305c2['TrueID']) { u0738( "SELECT * FROM ". $_config['db_table_prefix']."Sources ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`= '". $m305c2['TrueID'] ."' ". "LIMIT 1", 'get true source record by using the TrueID of just found record' ); $result=d0d6b(); if(count($result)) { $m305c2=$result[0]; } } } $va4a84=array ( 'Title' => $x03396['title'], 'AuthorName' => $x03396['author'], 'PictureURL' => $x03396['userpic-href'], ); if ($m305c2!==false){ if ( $m305c2['Title']!==$x03396['title'] or $m305c2['AuthorName']!==$x03396['author'] or $m305c2['PictureURL']!==$x03396['userpic-href'] ) { $va4a84['ID']=$m305c2['ID']; qaa79('Sources',$va4a84); } return $m305c2; } else { $va4a84['URL']=$x03396['href']; $va4a84['IsWhiteListed']=1; $va4a84['IsTrusted']=0; $va4a84=v9943('Sources',$va4a84); $va4a84['TrueID']=$va4a84['ID']; qaa79('Sources',$va4a84); return $va4a84; } } function q1a48($w39a37,$u34d5a=false){ global$_config; $vc6827=array(); if (@$w39a37['IsExternal']) { if(array_key_exists('SourceID',$w39a37)) { u0738( "SELECT * FROM `". $_config['db_table_prefix']."Sources` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". $w39a37['SourceID'] ."'", 'get source by id' ); $cfa816=d0d6b(); $vc6827['source']=$cfa816[0]['Title']; $vc6827['source-id']=$w39a37['SourceID']; $vc6827['source-true-id']=$cfa816[0]['TrueID']; $vc6827['source-whitelisted?']=$cfa816[0]['IsWhiteListed']; $vc6827['source-trusted?']=$cfa816[0]['IsTrusted']; if (!$cfa816[0]['IsTrusted']) { $vc6827['source-trust-url']=x83c8( 'e2m_source_trust', array ('source' => $w39a37['SourceID']) ); } if ($cfa816[0]['IsTrusted']) { $vc6827['source-premoderate-url']=x83c8( 'e2m_source_premoderate', array ('source' => $w39a37['SourceID']) ); } $vc6827['source-ban-url']=x83c8( 'e2m_source_ban', array ('source' => $w39a37['SourceID']) ); $vc6827['source-forget-url']=x83c8( 'e2m_source_forget', array ('source' => $w39a37['SourceID']) ); $vc6827['author']=$cfa816[0]['AuthorName']; $vc6827['author-href']=$cfa816[0]['URL']; $vc6827['userpic-href']=$cfa816[0]['PictureURL']; } if ($u34d5a){ if(array_key_exists('SourceNoteURL',$w39a37) and @$w39a37['SourceNoteURL']!=''){ $vc6827['href']=$w39a37['SourceNoteURL']; $vc6827['href-original']=$w39a37['SourceNoteURL']; } } } return $vc6827; } function e2m_frontpage($parameters=array ()) { global$settings,$_config,$_strings; $e71860=$parameters['page']; $iae0fe=1; $hd7e5d=$settings['appearance']['notes_per_page']; $u06d2e=u3456(true,true); if ($u06d2e!==null){ if (we852()) { $c90953=u3456(true,false); if ($c90953!==null)$u06d2e+=$c90953; } $iae0fe=ceil($u06d2e/$hd7e5d); } $xd29bb=CACHE_FILENAME_FRONTPAGE; if (we852())$xd29bb=CACHE_FILENAME_FRONTPAGE_AUTHOR; if ($e71860 < 1) return e2_error404_mode(); if(CACHE_FRONTPAGE and $e71860==1 and is_file($xd29bb)) { $z4358b=@unserialize(file_get_contents($xd29bb)); } if(CACHE_FRONTPAGE and $e71860==1 and is_array($z4358b)) { } else { try { $result=q7573($e71860); $z4358b=array(); if(count($result) > 0){ foreach($result as $d8ce4b => $saad65){ $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_title']=$saad65['Title']; $saad65['_']['_ord']=$d8ce4b; $saad65['_']['_ord_max']=count($result)-1; $ke244c=o6791($saad65); $z4358b[] = $ke244c; } } else { if ($e71860!=1) return e2_error404_mode(); } if(CACHE_FRONTPAGE and $e71860==1)k6e52($xd29bb,serialize($z4358b)); } catch (AeMySQLException $e){ b12f6($e,'Could not get latest notes for page '. $e71860); return array ( 'unavailable?' => true, 'title' => htmlspecialchars(n6f51(),ENT_NOQUOTES,HSC_ENC), ); } } $db3b32['timeline?']=true; $db3b32['count']=$iae0fe; $db3b32['this'] = (int)$e71860; if ($iae0fe > 1){ if ($e71860 < $iae0fe)$db3b32['earlier-href']=x83c8('e2m_frontpage', array ('page' => $e71860+1)); if ($e71860 > 1)$db3b32['later-href']=x83c8('e2m_frontpage', array ('page' => $e71860-1)); $db3b32['earlier-title']=$_strings['gs--earlier']; $db3b32['later-title']=$_strings['gs--later']; } $ld5d3d=n6f51(); return array ( 'frontpage?' => (bool) ($e71860==1), 'title' => $ld5d3d, 'notes' => $z4358b, 'pages' => $db3b32, ); } function q7573($e71860=1){ global$settings,$_config; $b19ee4=($e71860-1)*$settings['appearance']['notes_per_page']; $maa9f7=$b19ee4 .', '. $settings['appearance']['notes_per_page']; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". w6f32(we852()). "ORDER BY `Stamp` DESC ". "LIMIT ". $maa9f7, 'get latest notes for page '. $e71860 ); return d0d6b(); } function e2m_json($parameters=array ()) { list ($pb9076,$u20612)=lab26(); $z466de=json_encode($pb9076,E2_JSON_STYLE); q8ec5($z466de,$u20612,'json'); } function e2m_rss($parameters=array ()) { list ($pb9076,$u20612)=lab26(); $k8bb85=e2feeds__rss_using_jsonfeed_array_($pb9076); q8ec5($k8bb85,$u20612,'rss'); } function e2m_tag_json($parameters=array ()) { if(array_key_exists('*tag',$parameters)) { $rb19ad=$parameters['*tag']; } else { return e2_error404_mode(); } list ($pb9076,$u20612)=ce229($rb19ad); $z466de=json_encode($pb9076,E2_JSON_STYLE); q8ec5($z466de,$u20612,'json'); } function e2m_tag_rss($parameters=array ()) { global$settings,$_config,$_strings; if(array_key_exists('*tag',$parameters)) { $rb19ad=$parameters['*tag']; } else { return e2_error404_mode(); } list ($pb9076,$u20612)=ce229($rb19ad); $k8bb85=e2feeds__rss_using_jsonfeed_array_($pb9076); q8ec5($k8bb85,$u20612,'rss'); } function e2m_note_json($parameters=array ()) { global$settings,$_current_url; $w39a37=$parameters['*note']; if ($w39a37==false){ return e2_error404_mode(); } if (!yb44b($w39a37,we852())) { return e2_error404_mode(); } $w39a37['_']['_id']=$w39a37['ID']; $u20612=$w39a37['Stamp']; $d7da21=e2_jsonfeed_item_array_from_noterec_($w39a37); $k0bf08=array ($d7da21); $pb9076=e2_jsonfeed_array_stub_from_jsonfeed_item_arrays_($k0bf08); $pb9076['title']=n6f51(); $pb9076['home_page_url']=x83c8('e2m_frontpage', array ('page' => 1)); $pb9076['feed_url']=$_current_url; q8ec5(json_encode($pb9076,E2_JSON_STYLE),$u20612,'json'); } function e2_jsonfeed_array_stub_from_jsonfeed_item_arrays_($k0bf08){ global$_lang,$_config,$settings; $r2cb9d=[ 'version' => 'https://jsonfeed.org/version/1', 'title' => null, '_rss_description' => null, '_rss_language' => $_lang, '_itunes_email' => '', '_itunes_categories_xml' => '', '_itunes_image' => '', '_itunes_explicit' => '', 'home_page_url' => null, 'feed_url' => null, 'icon' => f2461(), 'author' => array ( 'name' => k2640(), 'url' => x83c8('e2m_frontpage', array ('page' => 1)), 'avatar' => f2461(), ), 'items' => $k0bf08, '_e2_version' => E2_VERSION, '_e2_ua_string' => E2_UA_STRING, ]; return $r2cb9d; } function e2_jsonfeed_item_array_from_noterec_($w39a37){ global$settings; $w39a37['_']['_id']=$w39a37['ID']; $t572d4=x83c8('e2m_note', array ('*note' => $w39a37)); $d803d0=( qa846('Y-m-d\TH:i:s',$w39a37['Stamp']) . nd536($w39a37['Stamp'],':') ); $aade16=( qa846('Y-m-d\TH:i:s',$w39a37['LastModified']) . nd536($w39a37['LastModified'],':') ); $s316ec=( qa846('D, d M Y H:i:s ',$w39a37['Stamp']) . nd536($w39a37['Stamp']) ); $o2bfe4=j154e($w39a37['FormatterID'], @$w39a37['Text'],'full-rss'); $sad965=tdbcc( 'note',$w39a37['_']['_id'], $o2bfe4['meta']['resources-detected'] ); $we70c4=array ( 'id' => (string)$w39a37['ID'], 'url' => $t572d4, 'title' => u6f10(htmlspecialchars($w39a37['Title'],ENT_NOQUOTES)), 'content_html' => $o2bfe4['text-final'], 'date_published' => $d803d0, 'date_modified' => $aade16, ); if ($w39a37['IsExternal']) { $b60d40=q1a48($w39a37,true); $we70c4['url']=$b60d40['href']; $we70c4['author'] = array ( 'name' => $b60d40['author'], 'url' => $b60d40['author-href'], 'avatar' => $b60d40['userpic-href'], ); } if(count($sad965) > 0){ $we70c4['image']=$sad965[0]; } $we70c4['_date_published_rfc2822']=$s316ec; if ($w39a37['Stamp'] < $settings['v3223_rss_permalinks_before_stamp']) { $we70c4['_rss_guid_is_permalink']='true'; $we70c4['_rss_guid']=$we70c4['url']; } else { $we70c4['_rss_guid_is_permalink']='false'; $we70c4['_rss_guid'] = (string)$w39a37['ID']; } $we70c4['_e2_data'] = array ( 'is_favourite' => (bool)$w39a37['IsFavourite'], 'links_required' => $o2bfe4['meta']['links-required'], 'og_images' => $sad965, ); return $we70c4; } function q3010($j7a402,$ld5d3d,$xe8fab){ global$_newsfeeds; if (!isset ($_newsfeeds))$_newsfeeds=[]; $kfc0f6=''; if ($j7a402=='rss')$kfc0f6='application/rss+xml'; if ($j7a402=='json')$kfc0f6='application/json'; $_newsfeeds[] = [ 'type' => $kfc0f6, 'title' => htmlspecialchars($ld5d3d,ENT_NOQUOTES,HSC_ENC), 'href' => $xe8fab ]; } function oed63(){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". w6f32(). "ORDER BY `Stamp` DESC ". "LIMIT ". $_config['rss_items'], 'get recent public noterecs for RSS or JSONFeed' ); return d0d6b(); } function lab26(){ global$settings,$_current_url; $u20612=0; $k0bf08=array(); $pb9076=array(); $xd29bb=CACHE_FILENAME_FRONTPAGE_FEED; if(CACHE_FRONTPAGE_FEED and is_file($xd29bb)) { if(Log::$ned2b5)__log('Feed array (RSS, JSON): cached'); $pb9076=@unserialize(file_get_contents($xd29bb)); $u20612=filemtime($xd29bb); } else { if(Log::$ned2b5)__log('Feed array (RSS, JSON): not cached, will need to build'); $pc2d18=oed63(); foreach ($pc2d18 as $w39a37){ $k0bf08[] = e2_jsonfeed_item_array_from_noterec_($w39a37); $u20612=max($u20612,$w39a37['Stamp']); } $f67daf=''; if(array_key_exists('description',$settings)) { $f67daf=$settings['description']; } if ((string)$f67daf!==''){ $o2bfe4=bb7f1($f67daf,'full'); $tfc882=$o2bfe4['text-final']; $tfc882=m5421($tfc882); } else { $tfc882=n6f51(); } $pb9076=e2_jsonfeed_array_stub_from_jsonfeed_item_arrays_($k0bf08); $pb9076['title']=n6f51(); $pb9076['_rss_description']=$tfc882; $pb9076['home_page_url']=x83c8('e2m_frontpage', array ('page' => 1)); $pb9076['feed_url']=$_current_url; if(CACHE_FRONTPAGE_FEED)k6e52($xd29bb,serialize($pb9076)); } return array ($pb9076,$u20612); } function ce229($rb19ad){ global$settings,$_config,$_strings,$_current_url; $u20612=0; $k0bf08=array(); u0738( "SELECT n.* ". "FROM `". $_config['db_table_prefix']."Notes` n ". "INNER JOIN `". $_config['db_table_prefix']."NotesKeywords` nk ". "ON nk.`NoteID` = n.`ID` ". "WHERE n.`SubsetID`=". $_config['db_table_subset'] ." ". "AND nk.`SubsetID`=". $_config['db_table_subset'] ." ". "AND (nk.`KeywordID` = ". $rb19ad['ID'] .") ". "AND n.`IsPublished` = 1 ". w6f32(we852()). "ORDER BY n.`Stamp` DESC ". "LIMIT ". $_config['rss_items'], 'get tag noterecs for RSS or JSONFeed' ); $pc2d18=d0d6b(); foreach ($pc2d18 as $w39a37){ $k0bf08[] = e2_jsonfeed_item_array_from_noterec_($w39a37); $u20612=max($u20612,$w39a37['Stamp']); } $f67daf=''; if ((string)$rb19ad['Description']!==''){ $f67daf=$rb19ad['Description']; } elseif(array_key_exists('description',$settings)) { $f67daf=$settings['description']; } if ((string)$f67daf!==''){ $o2bfe4=bb7f1($f67daf,'full'); $tfc882=$o2bfe4['text-final']; $tfc882=m5421($tfc882); } else { $tfc882=n6f51(); } $wb73b1=htmlspecialchars($rb19ad['PageTitle'],ENT_COMPAT,HSC_ENC); if ((string)$wb73b1!==''){ $ld5d3d=$wb73b1; } else { $ld5d3d=( n6f51() .': '. $_strings['gs--posts-tagged'] .' '. htmlspecialchars($rb19ad['Keyword'],ENT_COMPAT,HSC_ENC) ); } $pb9076=e2_jsonfeed_array_stub_from_jsonfeed_item_arrays_($k0bf08); $pb9076['title']=$ld5d3d; $pb9076['_rss_description']=$tfc882; $pb9076['home_page_url']=x83c8('e2m_tag', array ('*tag' => $rb19ad)); $pb9076['feed_url']=$_current_url; return array ($pb9076,$u20612); } function e2feeds__rss_using_jsonfeed_array_($content){ $b92eac=USER_FOLDER.'rss/rss.tmpl.php'; if (!is_file($b92eac)) { $b92eac=DEFAULTS_FOLDER.'rss/rss.tmpl.php'; } if(is_file($b92eac)) { ob_start(); include $b92eac; $k8bb85=ob_get_contents(); ob_end_clean(); } return $k8bb85; } function b99a9($k8bb85){ $k8bb85=str_replace("\x0",'',$k8bb85); for ($f865c0=0; $f865c0 < strlen($k8bb85); ++$f865c0){ if(ord($k8bb85[$f865c0]) < 32 and !in_array(ord($k8bb85[$f865c0]), array (10,13))) { $k8bb85[$f865c0]=''; } } return $k8bb85; } function q8ec5($n321c3,$u20612,$j7a402){ global$_config; $f69a10=gmdate('r',$u20612); $t1872a=md5($u20612); if ($j7a402=='rss'){ if (@$_config['dev_xml_as_text']) { header('Content-Type: text/plain'); } else { header('Content-Type: application/xml; charset=utf-8'); } } elseif ($j7a402=='json'){ header('Content-Type: application/json'); } else { header('Content-Type: text/plain'); } header('Last-modified: '. $f69a10); header('Etag: '. $t1872a); header('Cache-Control: public'); header('Expires: '. date('r',$u20612+SECONDS_IN_A_DAY)); $d0c3cd=isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false; $rc3522=isset($_SERVER['HTTP_IF_NONE_MATCH'])? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : false; if ( !$d0c3cd && !$rc3522 or $rc3522 && $rc3522!=$t1872a or $d0c3cd && $d0c3cd!=$f69a10 ){ if ($j7a402=='rss'){ $k8bb85=b99a9($k8bb85); } ini_set('zlib.output_compression',0); echo $n321c3; ini_set('zlib.output_compression',1); } else { header('HTTP/1.1 304 Not Modified'); } die; } function e2m_year($parameters=array ()) { global$_strings,$_config; $g84cdc=$parameters['year']; $u09d6c=e2l_get_string('pt--nth-year', array ('year' => $g84cdc)); if (!i1665($g84cdc)) { return e2_error404_mode(); } $ye6e7d=gmmktime(0,0,0,1,1,$g84cdc-1); $a029bd=gmmktime(0,0,0,1,1,$g84cdc+1); list ($a8aebd,$n5a7f3)=e2__fruitful_neighbours_with_ymd_($g84cdc); $xa6d40='e2m_year'; if ($a8aebd){ $db3b32['prev-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($a8aebd) ); $db3b32['prev-jump?'] = (bool) (gmdate('Y',$ye6e7d)!=gmdate('Y',$a8aebd)); $db3b32['prev-title']=gmdate('Y',$a8aebd); } if ($n5a7f3){ $db3b32['next-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($n5a7f3) ); $db3b32['next-jump?'] = (bool) (gmdate('Y',$a029bd)!=gmdate('Y',$n5a7f3)); $db3b32['next-title']=gmdate('Y',$n5a7f3); } $db3b32['timeline?']=false; $db3b32['this']=$g84cdc; $db3b32['this-title']=$g84cdc; $zb2442=lcc02('start'); $s8dbc7=lcc02('end'); if ( $g84cdc==h5a2f('Y',$zb2442['stamp'],$zb2442['timezone']) ) { $bfa098=h5a2f('m',$zb2442['stamp'],$zb2442['timezone']); } else { $bfa098=1; } if ( $g84cdc==qa846('Y',time()) ) { $cfd384=qa846('m',time()); } else { $cfd384=12; } $o6eac3=a9737($g84cdc); for ($n7436f=1; $n7436f <= 12; ++ $n7436f){ $a7f769=gmmktime(0,0,0,$n7436f,1,$g84cdc); $qd039b[$n7436f] = array ( 'number' => $n7436f, 'start-time' => array ($a7f769,j3211()), 'href' => gmdate('Y/m/',$a7f769), 'real?' => $n7436f >= $bfa098 and $n7436f <= $cfd384, 'fruitful?' => @in_array(gmdate('n',$a7f769),$o6eac3), ); } list ($b7b314,$wa1f20)=z5273($g84cdc); $r2cb9d=[ 'title' => $u09d6c, 'heading' => $u09d6c, 'pages' => $db3b32, 'year' => (int)$g84cdc, 'year-months' => $qd039b, ]; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished` = 1 ". w6f32(we852()). "AND `Stamp` BETWEEN ". $b7b314 ." ". "AND ". $wa1f20 ." ". "ORDER BY `Stamp`", 'get all notes for the year' ); $result=d0d6b(); $z4358b=o28df($result,$g84cdc); if(count($z4358b)) { $r2cb9d['notes-list']=$z4358b; } else { $r2cb9d['nothing']=$_strings['gs--no-such-notes']; } return $r2cb9d; } function e2m_month($parameters=array ()) { global$_strings,$_config; $g84cdc= $parameters['year']; $n7436f=$parameters['month']; $u09d6c=e2l_get_string( 'pt--nth-month-of-nth-year', array ('year' => $g84cdc,'month' => $n7436f) ); if (!i1665($g84cdc,$n7436f)) { return e2_error404_mode(); } $ye6e7d=gmmktime(0,0,0,$n7436f-1,1,$g84cdc); $a029bd=gmmktime(0,0,0,$n7436f+1,1,$g84cdc); list ($a8aebd,$n5a7f3)=e2__fruitful_neighbours_with_ymd_($g84cdc,$n7436f); $xa6d40='e2m_month'; if ($a8aebd){ $db3b32['prev-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($a8aebd) ); $db3b32['prev-jump?'] = (bool) (gmdate('Y/m',$ye6e7d)!=gmdate('Y/m',$a8aebd)); $db3b32['prev-title']=e2l_get_string( 'gs--nth-month-of-nth-year', array ( 'year' => gmdate('Y',$a8aebd),'month' => gmdate('n',$a8aebd) ) ); } if ($n5a7f3){ $db3b32['next-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($n5a7f3) ); $db3b32['next-jump?'] = (bool) (gmdate('Y/m',$a029bd)!=gmdate('Y/m',$n5a7f3)); $db3b32['next-title']=e2l_get_string( 'gs--nth-month-of-nth-year', array ( 'year' => gmdate('Y',$n5a7f3),'month' => gmdate('n',$n5a7f3) ) ); } $db3b32['timeline?']=false; $db3b32['this-title']=$u09d6c; list ($b7b314,$wa1f20)=z5273($g84cdc,$n7436f); $r2cb9d=[ 'title' => $u09d6c, 'heading' => $u09d6c, 'pages' => $db3b32, 'year' => (int)$g84cdc, 'month' => (int)$n7436f, 'month-days' => e2_pack_month_days_with_ymd_($g84cdc,$n7436f,false), ]; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished` = 1 ". w6f32(we852()). "AND `Stamp` BETWEEN ". $b7b314 ." ". "AND ". $wa1f20 ." ". "ORDER BY `Stamp`", 'get all notes for the month' ); $result=d0d6b(); $z4358b=o28df($result,$g84cdc,$n7436f); if(count($z4358b)) { $r2cb9d['notes-list']=$z4358b; } else { $r2cb9d['nothing']=$_strings['gs--no-such-notes']; } return $r2cb9d; } function e2m_day($parameters=array ()) { global$_strings; $g84cdc= (int)$parameters['year']; $n7436f=(int)$parameters['month']; $g628b7= (int)$parameters['day']; if (!(i1665($g84cdc,$n7436f,$g628b7))) { return e2_error404_mode(); } $u09d6c=e2l_get_string( 'pt--nth-day-of-nth-month-of-nth-year', array ('year' => $g84cdc,'month' => $n7436f,'day' => $g628b7) ); $ye6e7d=gmmktime(0,0,0,$n7436f,$g628b7-1,$g84cdc); $a029bd=gmmktime(0,0,0,$n7436f,$g628b7+1,$g84cdc); list ($a8aebd,$n5a7f3)=e2__fruitful_neighbours_with_ymd_($g84cdc,$n7436f,$g628b7); $xa6d40='e2m_day'; if ($a8aebd){ $db3b32['prev-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($a8aebd) ); $db3b32['prev-jump?'] = (bool) (gmdate('Y/m/d',$ye6e7d)!=gmdate('Y/m/d',$a8aebd)); $db3b32['prev-title']=e2l_get_string( 'gs--nth-day-of-nth-month-of-nth-year', array ( 'year' => gmdate('Y',$a8aebd),'month' => gmdate('n',$a8aebd),'day' => gmdate('j',$a8aebd), ) ); } if ($n5a7f3){ $db3b32['next-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($n5a7f3) ); $db3b32['next-jump?'] = (bool) (gmdate('Y/m/d',$a029bd)!=gmdate('Y/m/d',$n5a7f3)); $db3b32['next-title']=e2l_get_string( 'gs--nth-day-of-nth-month-of-nth-year', array ( 'year' => gmdate('Y',$n5a7f3),'month' => gmdate('n',$n5a7f3),'day' => gmdate('j',$n5a7f3), ) ); } $db3b32['timeline?']=false; $db3b32['this-title']=$u09d6c; $r2cb9d=[ 'title' => $u09d6c, 'heading' => $u09d6c, 'pages' => $db3b32, 'month-days' => e2_pack_month_days_with_ymd_($g84cdc,$n7436f,$g628b7), ]; $result=rf9fb($g84cdc,$n7436f,$g628b7); $result=array_reverse($result); $o15514=we852(); foreach($result as $d8ce4b => $w39a37){ if (yb44b($w39a37,$o15514)) { $w39a37['_']['_id']=$w39a37['ID']; $w39a37['_']['_ord']=$d8ce4b; $w39a37['_']['_ord_max']=count($result)-1; $z4358b[] = o6791($w39a37); } } if(count($z4358b)) { $r2cb9d['notes']=$z4358b; } else { $r2cb9d['nothing']=$_strings['gs--no-such-notes']; } return $r2cb9d; } function m71d9(){ global$_config; $z4358b=null; if(CACHE_FULLLIST and is_file(CACHE_FILENAME_FULLLIST)) { $z4358b=@unserialize(file_get_contents(CACHE_FILENAME_FULLLIST)); if(Log::$ned2b5)__log('Retrieving full notes list from cache...'); } if (!is_array($z4358b)) { if(Log::$ned2b5)__log('Retrieving full notes list from database...'); u0738( "SELECT `ID`, `Title`, `Stamp`, `LastModified`, `Offset`, `IsDST`, ". "`IsFavourite`, `IsPublished`, `IsVisible`, `SourceNoteURL`, `OriginalAlias` ". "FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished` = 1 ". w6f32(). "ORDER BY `Stamp`", 'get full notes list' ); $result=d0d6b(); $z4358b=o28df($result); if(CACHE_FULLLIST)k6e52(CACHE_FILENAME_FULLLIST,serialize($z4358b)); } return $z4358b; } function e2m_everything($parameters=array ()) { global$_strings; $z4358b=m71d9(); $s1f525=count($z4358b); $u09d6c=e2l_get_string('pt--n-posts', array ('number' => $s1f525)); $r2cb9d=[ 'title' => $u09d6c, 'heading' => $u09d6c, ]; if(count($z4358b)) { $r2cb9d['notes-list']=$z4358b; } else { $r2cb9d['nothing']=$_strings['gs--no-notes']; } return $r2cb9d; } function e2m_sitemap_xml($parameters=array ()) { global$_config; $z4358b=m71d9(); if (@$_config['dev_xml_as_text']) { header('Content-Type: text/plain'); } else { header('Content-type: application/xml; charset=utf-8'); } echo '<?xml version="1.0" encoding="UTF-8"?>'."\r\n"; echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\r\n"; if(count($z4358b)) { $u20612=@$z4358b[0]['last-modified']; echo '<url>'."\r\n"; echo '<loc>'. x83c8('e2m_frontpage', array ('page' => 1)) .'</loc>'."\r\n"; echo '<lastmod>'; echo gmdate('Y-m-d\TH:i:s\Z',$u20612[0]); echo '</lastmod>'."\r\n"; echo '<changefreq>hourly</changefreq>'; echo '</url>'."\r\n"; foreach ($z4358b as $saad65){ echo '<url>'."\r\n"; echo '<loc>'; echo $saad65['href']; echo '</loc>'."\r\n"; echo '<lastmod>'; echo gmdate('Y-m-d\TH:i:s\Z',$saad65['last-modified'][0]); echo '</lastmod>'."\r\n"; echo '</url>'."\r\n"; } } echo '</urlset>'."\r\n"; die; } function e2_pack_month_days_with_ymd_($g84cdc,$n7436f,$g628b7){ $ta6933=h5a2f('t',gmmktime(0,0,0,$n7436f,1,$g84cdc),j3211()); $zb2442=lcc02('start'); $s8dbc7=lcc02('end'); if ( $g84cdc .'/'. $n7436f == h5a2f('Y/n',$zb2442['stamp'],$zb2442['timezone']) ) { $f42eb4=h5a2f('d',$zb2442['stamp'],$zb2442['timezone']); } else { $f42eb4=1; } if ( $g84cdc .'/'. $n7436f == qa846('Y/n',time()) ) { $kd5f50=qa846('d',time()); } else { $kd5f50=$ta6933; } $me4602=iae09($g84cdc,$n7436f); for ($f865c0=1; $f865c0 <= $ta6933; ++ $f865c0){ $a7f769=gmmktime(0,0,0,$n7436f,$f865c0,$g84cdc); $y271c1[$f865c0] = array ( 'number' => $f865c0, 'start-time' => array ($a7f769,j3211()), 'href' => gmdate('Y/m/d/',$a7f769), 'this?' => (bool) ($f865c0==$g628b7), 'real?' => $f865c0 >= $f42eb4 and $f865c0 <= $kd5f50, 'fruitful?' => @in_array(gmdate('d',$a7f769),$me4602), ); } return $y271c1; } function i1665($g84cdc,$n7436f=false,$g628b7=false){ $zb2442=lcc02('start'); if ($zb2442===false){ return false; } $sc1f1e=h5a2f('Y',$zb2442['stamp'],$zb2442['timezone']); $vebeb3=qa846('Y',time()); if ($n7436f===false){ return (bool) ( $g84cdc >= $sc1f1e and $g84cdc <= $vebeb3 ); } else { $d782fc=h5a2f('n',$zb2442['stamp'],$zb2442['timezone']); $v13dd1=qa846('n',time()); if ($g628b7===false){ return (bool) ( $n7436f >= 1 and $n7436f <= 12 and ( ($g84cdc > $sc1f1e and $g84cdc < $vebeb3) or ($g84cdc==$sc1f1e and $n7436f >= $d782fc) or ($g84cdc==$vebeb3 and $n7436f <= $v13dd1) ) ); } else { $d7a9c0=h5a2f('j',$zb2442['stamp'],$zb2442['timezone']); $e23209=qa846('j',time()); if(1){ return (bool) ( checkdate($n7436f,$g628b7,$g84cdc) and ( ($g84cdc > $sc1f1e and $g84cdc < $vebeb3) or ($g84cdc==$sc1f1e and $n7436f > $d782fc) or ($g84cdc==$sc1f1e and $n7436f==$d782fc and $g628b7 >= $d7a9c0) or ($g84cdc==$vebeb3 and $n7436f < $v13dd1) or ($g84cdc==$vebeb3 and $n7436f==$v13dd1 and $g628b7 <= $e23209) ) ); } } } } function e2__fruitful_neighbours_with_ymd_($q41529,$t6f8f5=false,$r8277e=false){ global$_db,$_config; list ($u3d2fa,$z9468c)=z5273($q41529,$t6f8f5,$r8277e); $wada4b=SECONDS_IN_A_DAY; if ($r8277e===false)$wada4b=SECONDS_IN_A_MONTH; if ($t6f8f5===false)$wada4b=SECONDS_IN_A_YEAR; $xbf025=$p8dc98=null; u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']. "Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". "AND `Stamp` < '". ($z9468c-$wada4b) ."' ". w6f32(we852()). "ORDER BY Stamp DESC", 'get previous fruitful neighbour with ymd' ); while ($s6438c=mysqli_fetch_array($_db['result'],MYSQLI_ASSOC)) { list ($g84cdc,$n7436f,$g628b7)=explode('/', h5a2f('Y/n/j',$s6438c['Stamp'],l0923($s6438c)) ); $n7474d=$q41529*10000 + ($t6f8f5? ($t6f8f5*100):0) + ($r8277e? $r8277e:0); $bbd8da=$g84cdc*10000 + ($t6f8f5? ($n7436f*100):0) + ($r8277e? $g628b7:0); if ($bbd8da < $n7474d){ $xbf025=gmmktime(0,0,0,$n7436f,$g628b7,$g84cdc); break; } } u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']. "Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". "AND `Stamp` > '". ($u3d2fa+$wada4b) ."' ". w6f32(we852()). "ORDER BY Stamp", 'get next fruitful neighbour with ymd' ); while ($s6438c=mysqli_fetch_array($_db['result'],MYSQLI_ASSOC)) { list ($g84cdc,$n7436f,$g628b7)=explode('/', h5a2f('Y/n/j',$s6438c['Stamp'],l0923($s6438c)) ); $n7474d=$q41529*10000 + ($t6f8f5? ($t6f8f5*100):0) + ($r8277e? $r8277e:0); $bbd8da=$g84cdc*10000 + ($t6f8f5? ($n7436f*100):0) + ($r8277e? $g628b7:0); if ($bbd8da > $n7474d){ $p8dc98=gmmktime(0,0,0,$n7436f,$g628b7,$g84cdc); break; } } return [$xbf025,$p8dc98]; } function e2__parameters_with_timestamp_($k96b8c){ list ( $parameters['year'], $parameters['month'], $parameters['day'] ) = explode('/',gmdate('Y/m/d',$k96b8c)); return$parameters; } function o28df($pc2d18,$g84cdc=false,$n7436f=false){ $c229c3=0; $z4358b=array(); $qf09d8=''; $z4358b=array(); $icc73f=array(); foreach ($pc2d18 as $d8ce4b => $w39a37){ $saad65['href'] = x83c8('e2m_note', array ('*note' => $w39a37)); $saad65['time'] = array ((int)min($w39a37['Stamp'],time()), l0923($w39a37)); $saad65['last-modified'] = array ((int)min($w39a37['LastModified'],time()), l0923($w39a37)); $saad65['favourite?'] = (bool) ($w39a37['IsFavourite'] && $w39a37['IsPublished']); $saad65['visible?'] = yb44b($w39a37); if(array_key_exists('SourceNoteURL',$w39a37) and @$w39a37['SourceNoteURL']!=''){ $saad65['href']=$w39a37['SourceNoteURL']; $saad65['href-original']=$w39a37['SourceNoteURL']; } if ( ($g84cdc and $n7436f and ( ((int)$g84cdc) .'/'. ((int)$n7436f) == h5a2f('Y/n',$w39a37['Stamp'],l0923($w39a37)) )) or ($g84cdc and !$n7436f and ( (int)$g84cdc == h5a2f('Y',$w39a37['Stamp'],l0923($w39a37)) )) or (!$g84cdc and !$n7436f) ) { array_unshift($z4358b,$saad65); array_unshift($icc73f,str_replace("\n",' ',$w39a37['Title'])); } } $m789f1=implode("\n",$icc73f); $m789f1=u6f10(htmlspecialchars($m789f1,ENT_NOQUOTES,HSC_ENC)); $icc73f=explode("\n",$m789f1); foreach ($z4358b as $d8ce4b => $t9e366){ $z4358b[$d8ce4b]['title']=$icc73f[$d8ce4b]; } return $z4358b; } function a9737($q41529){ global$_config; list ($b5a603,$kc2b31)=z5273($q41529); u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". "AND `Stamp` BETWEEN '". $b5a603. "' AND '". $kc2b31 ."' ". w6f32(we852()), 'get all notes for the year '. $q41529 .' to list months with notes' ); $result=d0d6b(); $pda36c=array(); foreach($result as $m65afd){ if ( ((int)$q41529) == h5a2f('Y',$m65afd['Stamp'],l0923($m65afd)) ) { $pda36c[] = (int)h5a2f('n',$m65afd['Stamp'],l0923($m65afd)); } } $pda36c=@array_unique($pda36c); sort($pda36c); return $pda36c; } function iae09($q41529,$t6f8f5){ global$_config; list ($dfc6b2,$q10df4)=z5273($q41529,$t6f8f5); u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". "AND `Stamp` BETWEEN '". $dfc6b2 ."' AND '". $q10df4 ."' ". w6f32(we852()), 'get all notes for the month '.$t6f8f5.' of the year '. $q41529 .' to list days with notes' ); $result=d0d6b(); $q44fde=array(); foreach($result as $m65afd){ if ( ((int)$q41529) .'/'. ((int)$t6f8f5) == h5a2f('Y/n',$m65afd['Stamp'],l0923($m65afd)) ) { $q44fde[] = (int)h5a2f('j',$m65afd['Stamp'],l0923($m65afd)); } } $q44fde=@array_unique($q44fde); sort($q44fde); return $q44fde; } function lcc02($r92c58){ global$_config; $v8b7af='p1'; if (!we852()) { $v8b7af='p1v1'; } $xd29bb=CACHES_FOLDER.$r92c58 .'-stamp-'. $v8b7af .'.e2time.psa'; if(CACHE_EDGE_TIMEINFO and is_file($xd29bb)) { $r2cb9d=@unserialize(file_get_contents($xd29bb)); } if(is_array($r2cb9d)) { return $r2cb9d; } else { $r2cb9d=array ( 'stamp' => time(), 'timezone' => g5c05(), ); if ($r92c58=='start'){ u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". w6f32(we852()). "ORDER BY `Stamp` LIMIT 1", 'get blog start timestamp' ); } elseif ($r92c58=='end'){ u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". w6f32(we852()). "ORDER BY `Stamp` DESC LIMIT 1", 'get blog latest note timestamp' ); } $result=d0d6b(); if(count($result)) { $r2cb9d=array ( 'stamp' => $result[0]['Stamp'], 'timezone' => l0923($result[0]), ); if(CACHE_EDGE_TIMEINFO)k6e52($xd29bb,serialize($r2cb9d)); return $r2cb9d; } return $r2cb9d; } } define('CACHE',true); define('CACHE_NOTES',CACHE and true); define('CACHE_NOTES_COMMENTS',CACHE and true); define('CACHE_POPULAR',CACHE and true); define('CACHE_HOT',CACHE and true); define('CACHE_FAVS',CACHE and true); define('CACHE_TAGS',CACHE and true); define('CACHE_FAVTAGS',CACHE and true); define('CACHE_NOTES_COUNTS',CACHE and true); define('CACHE_EDGE_TIMEINFO',CACHE and true); define('CACHE_FRONTPAGE',CACHE and true); define('CACHE_FRONTPAGE_FEED',CACHE and true); define('CACHE_FULLLIST',CACHE and true); define('CACHE_DRAFTS',CACHE and true); define('CACHE_DRAFTS_ALIAS_USE_COUNTS',CACHE and true); define('CACHE_LASTMODIFIEDS',CACHE and true); define('CACHE_FILENAMES_NOTES',CACHES_FOLDER.'note-*.ctree.psa'); define('CACHE_FILENAMES_NOTES_COMMENTS', CACHES_FOLDER.'note-*-comments.ctree.psa' ); define('CACHE_FILENAMES_NOTES_COMMENTS_AUTHOR', CACHES_FOLDER.'note-*-comments-author.ctree.psa' ); define('CACHE_FILENAMES_NOTES_COUNTS',CACHES_FOLDER.'notes-count-*.txt'); define('CACHE_FILENAMES_EDGE_TIMEINFO',CACHES_FOLDER.'*.e2time.psa'); define('CACHE_FILENAME_POPULAR',CACHES_FOLDER.'popular.ctree.psa'); define('CACHE_FILENAME_POPULAR_EXPIRES',CACHES_FOLDER.'popular-expires.txt'); define('CACHE_FILENAME_HOT',CACHES_FOLDER.'hot.ctree.psa'); define('CACHE_FILENAME_HOT_EXPIRES',CACHES_FOLDER.'hot-expires.txt'); define('CACHE_FILENAME_FAVS',CACHES_FOLDER.'favourites.ctree.psa'); define('CACHE_FILENAME_TAGS',CACHES_FOLDER.'tags.ctree.psa'); define('CACHE_FILENAME_TAGS_FULL',CACHES_FOLDER.'tags-full.ctree.psa'); define('CACHE_FILENAME_TAGS_AUTHOR',CACHES_FOLDER.'tags-author.ctree.psa'); define('CACHE_FILENAME_TAGS_AUTHOR_FULL',CACHES_FOLDER.'tags-author-full.ctree.psa'); define('CACHE_FILENAME_FAVTAGS',CACHES_FOLDER.'favtags.ctree.psa'); define('CACHE_FILENAME_FRONTPAGE',CACHES_FOLDER.'frontpage.ctree.psa'); define('CACHE_FILENAME_FRONTPAGE_AUTHOR',CACHES_FOLDER.'frontpage-author.ctree.psa'); define('CACHE_FILENAME_FRONTPAGE_FEED',CACHES_FOLDER.'frontpage-feed.psa'); define('CACHE_FILENAME_FULLLIST',CACHES_FOLDER.'notes-list.ctree.psa'); define('CACHE_FILENAME_DRAFTS',CACHES_FOLDER.'drafts.psa'); define('CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS',CACHES_FOLDER.'drafts-auc.psa'); define('CACHE_FILENAME_LASTMODIFIEDS',CACHES_FOLDER.'last-modifieds-by-id.psa'); function e2s_sync(){ e2_drop_all_kinds_of_cache(); die ('All caches clean.'); } function e2_note_cache_filename_with_id_($xb80bb){ return str_replace('*',$xb80bb,CACHE_FILENAMES_NOTES); } function e2_drop_caches_for_note_($y21158){ if(is_numeric($y21158)) { if(Log::$ned2b5)__log('Caches: Drop caches for note id '. $y21158); @unlink(e2_note_cache_filename_with_id_($y21158)); @unlink(e2_note_cache_filename_with_id_($y21158 .'-comments')); @unlink(e2_note_cache_filename_with_id_($y21158 .'-comments-author')); } else { jc5a6(CACHE_FILENAMES_NOTES); jc5a6(CACHE_FILENAMES_NOTES_COMMENTS); jc5a6(CACHE_FILENAMES_NOTES_COMMENTS_AUTHOR); } le2f1(); x22e7(); @unlink(CACHE_FILENAME_HOT); @unlink(CACHE_FILENAME_POPULAR); @unlink(CACHE_FILENAME_FRONTPAGE); @unlink(CACHE_FILENAME_FRONTPAGE_AUTHOR); @unlink(CACHE_FILENAME_FRONTPAGE_FEED); @unlink(CACHE_FILENAME_FULLLIST); @unlink(CACHE_FILENAME_TAGS); @unlink(CACHE_FILENAME_TAGS_FULL); @unlink(CACHE_FILENAME_TAGS_AUTHOR); @unlink(CACHE_FILENAME_TAGS_AUTHOR_FULL); @unlink(CACHE_FILENAME_LASTMODIFIEDS); } function i7996(){ if(Log::$ned2b5)__log('Caches: Drop notes caches'); e2_drop_caches_for_note_(null); } function le2f1(){ if(Log::$ned2b5)__log('Caches: Drop notes counts cache'); jc5a6(CACHE_FILENAMES_NOTES_COUNTS); } function x22e7(){ if(Log::$ned2b5)__log('Caches: Drop egde time info cache'); jc5a6(CACHE_FILENAMES_EDGE_TIMEINFO); } function e2_drop_all_kinds_of_cache(){ if(Log::$ned2b5)__log('Caches: Drop all kinds of caches'); jc5a6(CACHES_FOLDER.'*'); return true; } define('OLBA_SPECIAL_CHAR',"\x1"); define('OLBA_SPECIAL_SEQUENCE_LENGTH',6); function udb82($p139c8=null){ global$_template,$_config,$settings; if ($p139c8===null)$p139c8=@$settings['template']; $u1b14d=null; $ja5fca=null; $u00e30=null; $w37c8a=null; $maf10b=array(); $hd9ecb=$p139c8; if ($hd9ecb!==null){ while (1){ if(Log::$ned2b5)__log('Prepare theme "'. $hd9ecb .'"'); $t620f7=TEMPLATES_FOLDER.$hd9ecb .'/'; if ( !is_dir($t620f7) or !is_file($t620f7 .'/theme-info.php') ) { if(Log::$ned2b5)__log('Theme "'. $hd9ecb .'" not found, using default theme "'. DEFAULT_TEMPLATE .'"'); $hd9ecb=DEFAULT_TEMPLATE; $t620f7=TEMPLATES_FOLDER.$hd9ecb .'/'; } array_push($maf10b,$t620f7); $l38226=include $t620f7 .'/theme-info.php'; $w4e502[$t620f7]=$l38226; if(array_key_exists('max_image_width',$l38226)) { if ($u1b14d===null){ $u1b14d=$l38226['max_image_width']; } } if(array_key_exists('meta_viewport',$l38226)) { if ($ja5fca===null){ $ja5fca=$l38226['meta_viewport']; } } if(array_key_exists('supports_dark_mode',$l38226)) { if ($u00e30===null){ $u00e30=$l38226['supports_dark_mode']; } } if(array_key_exists('use_likely_light',$l38226)) { if ($w37c8a===null){ $w37c8a=$l38226['use_likely_light']; } } if(array_key_exists('based_on',$l38226)) { $hd9ecb=$l38226['based_on']; } else { break; } } } if ($u1b14d===null){ $u1b14d=$_config['max_image_width']; } if ($ja5fca===null)$ja5fca=''; if ($u00e30===null)$u00e30=false; if ($w37c8a===null)$w37c8a=false; $t620f7=SYSTEM_TEMPLATE_FOLDER; array_push($maf10b,$t620f7); $_template['name']=$p139c8; $_template['max_image_width']=$u1b14d; $_template['meta_viewport']=$ja5fca; $_template['supports_dark_mode']=$u00e30; $_template['use_likely_light']=$w37c8a; $_template['stack']=$maf10b; $_template['infos']=$w4e502; }; function f53ee($sd436e){ global$content; if (!isset ($_olba_includes))$_olba_includes=0; ++ $_olba_includes; if(Log::$ned2b5)__log('Eat "'. $sd436e .'"'); include $sd436e; } function af671($f6a992){ return ( OLBA_SPECIAL_CHAR. str_pad($f6a992,OLBA_SPECIAL_SEQUENCE_LENGTH,'0',STR_PAD_LEFT). OLBA_SPECIAL_CHAR ); } function tab71($vb0689){ static $f6a992=0; uf1da($vb0689,'_olba_placeholders'); echo af671($f6a992 ++); } function y326f($e78e62){ global$_olba_placeholders; foreach($_olba_placeholders as $f6a992 => $w2063c){ $xe068c=af671($f6a992); $d5e0bd=strpos($e78e62,$xe068c); $sf5300=q166b($w2063c,true); if ($d5e0bd!==false){ $e78e62=substr_replace( $e78e62,$sf5300,$d5e0bd,strlen($xe068c) ); } else { break; } } return $e78e62; } function a6a97($b52678){ if(is_dir(EXTRAS_FOLDER)) { $i71cae=EXTRAS_FOLDER.$b52678 .'.tmpl.php'; if(is_file($i71cae)) { f53ee($i71cae); } } return ''; } function q166b($b52678,$we70c4=false){ global$_template,$_olba_includes; $i71cae='templates/'. $b52678 .'.tmpl.php'; if ($sd436e=e2o__usable_file_with_basename_($i71cae)) { if ($we70c4){ ob_start(); } f53ee($sd436e); if ($we70c4){ $r2cb9d=ob_get_contents(); ob_end_clean(); return $r2cb9d; } } else { ob_end_clean(); throw new AeOlbaTemplateMissingException('Missing: '. $i71cae); } } function gbc21(){ global$_config; if ( @$_config['raw_template_data'] or @$_config['raw_template_data_with_param'] and array_key_exists('raw',$_GET) ) { $v3f7d9='raw'; } else { $v3f7d9='main'; } return q166b($v3f7d9,true); } function hd4c1($w45ac4){ uf1da($w45ac4 .'.css','_olba_used_stylesheets'); } function xd00a($s3205c){ uf1da($s3205c .'.js','_olba_used_scripts'); } function v16f0($be8acc){ foreach (array (SYSTEM_LIBRARY_FOLDER,USER_LIBRARY_FOLDER) as $a71379){ foreach(glob($a71379.$be8acc .'/*') as $d8c7dd){ $iabf77=pathinfo($d8c7dd,PATHINFO_EXTENSION); if ($iabf77=='js'){ uf1da($d8c7dd,'_olba_used_scripts'); } if ($iabf77=='css'){ uf1da($d8c7dd,'_olba_used_stylesheets'); } } } } function k94dd(){ global$_template,$_config,$settings; if ($ge1260=@opendir(TEMPLATES_FOLDER)) { while (false !== ($x1f769=readdir($ge1260))) { if(is_dir(TEMPLATES_FOLDER. $x1f769) and $x1f769!='.' and $x1f769!='..'){ if(is_file(TEMPLATES_FOLDER.$x1f769 .'/theme-info.php')) { $gccf6b[$x1f769]=TEMPLATES_FOLDER.$x1f769 .'/'; } } } closedir($ge1260); } $d10ae9=array(); $e2e3a2=1000; foreach ($gccf6b as $vb0689 => $y85114){ $l38226=include $y85114 .'theme-info.php'; $yc2657=@$l38226['display_name']; if (!$yc2657) continue; if(is_array($yc2657)) { if(array_key_exists($settings['language'],$yc2657)) { $yc2657=$yc2657[$settings['language']]; } else { $yc2657=array_shift($yc2657); } } $f6a992=@$l38226['index'] or $f6a992=$e2e3a2 ++; $o62848=@$l38226['colors']; if (!$o62848)$o62848=array ( 'background' => 'transparent', 'headings' => 'rgba(128,128,128,.2)', 'text' => 'rgba(128,128,128,.2)', 'link' => 'rgba(128,128,128,.2)', ); $h16e25=(bool) ($vb0689==$_template['name']); if ($h16e25){ $ucd143=x83c8('e2m_theme_preview', array ('theme' => '')); } else { $ucd143=x83c8('e2m_theme_preview', array ('theme' => $vb0689)); } $d10ae9[$f6a992] = array ( 'name' => $vb0689, 'display-name' => $yc2657, 'colors' => $o62848, 'current?' => $h16e25, 'preview-url' => $ucd143, 'supports-dark-mode?' => $l38226['supports_dark_mode'], ); } ksort($d10ae9); return $d10ae9; } function b1492($j435ed){ return e2o__usable_file_with_basename_('images/'. $j435ed); } function kf42c($mb1197){ return file_get_contents(e2o__usable_file_with_basename_('images/'. $mb1197 .'.svg')); } function h576f($w45ac4){ global$_template; $o954eb='styles/'. $w45ac4 .'.css'; $y95aa1=array(); foreach($_template['stack'] as $t620f7){ if(is_file($j435ed=$t620f7.$o954eb)) { $y95aa1[] = $j435ed; } if ( array_key_exists('reset_styles',$_template['infos'][$t620f7]) and in_array($w45ac4,$_template['infos'][$t620f7]['reset_styles']) ) { break; } } $y95aa1=array_reverse($y95aa1); } function l37ca(){ global$_olba_used_stylesheets,$_template; if (!isset ($_olba_used_stylesheets)) return; $_olba_used_stylesheets=array_unique($_olba_used_stylesheets); $qc7f50=array(); foreach($_olba_used_stylesheets as $w45ac4){ if(is_file($w45ac4)) { $qc7f50[] = $w45ac4; continue; } if(is_file($j435ed=USER_FOLDER .'js/'. $w45ac4)) { $qc7f50[] = $j435ed; } $o954eb='styles/'. $w45ac4; $y95aa1=array(); foreach($_template['stack'] as $t620f7){ if(is_file($j435ed=$t620f7.$o954eb)) { $y95aa1[] = $j435ed; } if ( array_key_exists('reset_styles',$_template['infos'][$t620f7]) and in_array($w45ac4,$_template['infos'][$t620f7]['reset_styles']) ) { break; } } $y95aa1=array_reverse($y95aa1); $qc7f50=array_merge($qc7f50,$y95aa1); } foreach ($qc7f50 as $d8ce4b => $t9e366){ $jbc7b3=stat($t9e366); $qc7f50[$d8ce4b].='?'. $jbc7b3['mtime']; } return $qc7f50; } function o4753(){ global$_olba_used_scripts; if (!isset ($_olba_used_scripts)) return; $_olba_used_scripts=array_unique($_olba_used_scripts); $bd6c58=array(); foreach($_olba_used_scripts as $s3205c){ if ( substr($s3205c,0,7)=='http://' or substr($s3205c,0,8)=='https://' or substr($s3205c,0,2)=='//' ){ $bd6c58[] = $s3205c; continue; } if(is_file($s3205c)) { $bd6c58[] = $s3205c; continue; } if(is_file($v9d679=USER_FOLDER .'js/'. $s3205c)) { $bd6c58[] = $v9d679; } $o954eb='js/'. $s3205c; if ($v9d679=e2o__usable_file_with_basename_($o954eb)) { $bd6c58[] = $v9d679; } } foreach ($bd6c58 as $d8ce4b => $t9e366){ $jbc7b3=stat($t9e366); if ($jbc7b3['mtime']) { $bd6c58[$d8ce4b].='?'. $jbc7b3['mtime']; } } return $bd6c58; } function a57ad($ob268d){ if (!is_array($ob268d)) return; foreach ($ob268d as $q2a304){ if(substr($q2a304, -3)=='.js'){ xd00a(substr($q2a304,0, -3)); } if(substr($q2a304, -4)=='.css'){ hd4c1(substr($q2a304,0, -4)); } } } function uf1da($w2063c,$cf1f71){ if (!isset ($GLOBALS[$cf1f71])) { $GLOBALS[$cf1f71] = array ($w2063c); } else { $GLOBALS[$cf1f71][] = $w2063c; } } function e2o__usable_file_with_basename_($o954eb){ global$_template; if (!isset ($_template))udb82(); foreach($_template['stack'] as $t620f7){ if(is_file($j435ed=$t620f7.$o954eb)) { return $j435ed; } } return ''; } function e2m_theme_preview($parameters){ global$_lang,$_strings,$_superconfig,$_template; if (@$_superconfig['disallow_themes_preview']) { return e2_error404_mode(); } if($parameters['theme']==$_template['name']) { e2_go_to(x83c8('e2m_theme_preview', array ('theme' => ''))); } if($parameters['theme']) { udb82($parameters['theme']); } $m75725=$_lang; if (!is_file($d8c7dd='system/preview/'. $m75725 .'.php')) { $m75725=$_strings['--secondary-language']; $d8c7dd='system/preview/'. $m75725 .'.php'; } if (!is_file($d8c7dd='system/preview/'. $m75725 .'.php')) { $d8c7dd='system/preview/'. DEFAULT_LANGUAGE .'.php'; } $we70c4=include $d8c7dd; return $we70c4; } define('SEARCH_EXTRA_PREFIX','Rose'); define('SEARCH_LIMIT',20); define('SEARCH_SNIPPETS_LIMIT',20); define('SEARCH_USE_ROSE',1); define('SEARCH_USE_MYSQL',1); define('BSI_SELECT_PORTION',10); define('BSI_GIVE_UP_TIMEOUT',10); define('BSI_UNLOCK_TIMEOUT',10); use S2\Rose\Storage\Exception\EmptyIndexException; use S2\Rose\Storage\Database\PdoStorage; use S2\Rose\Stemmer\PorterStemmerEnglish; use S2\Rose\Stemmer\PorterStemmerRussian; use S2\Rose\Indexer; use S2\Rose\Entity\Indexable; use S2\Rose\Entity\Query; use S2\Rose\Finder; use S2\Rose\SnippetBuilder; function e2m_found($parameters=array ()) { global$_strings,$_config,$settings,$full_blog_url; $parameters['query']=trim($parameters['query']); $b1b1cc=$parameters['query']; if (!$b1b1cc){ return array ( 'title' => $_strings['pt--search-query-empty'], 'heading' => $_strings['pt--search'], 'nothing' => $_strings['gs--search-query-empty'], ); } $b11128=false; try { u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `Keyword`='". a7928($b1b1cc) ."'", 'get tags matching the search query' ); $cfa816=d0d6b(); if (isset ($cfa816[0]['ID'])) { $b11128=array ( 'href' => x83c8('e2m_tag', array ('*tag' => $cfa816[0])), 'name' => htmlspecialchars($b1b1cc,ENT_NOQUOTES,HSC_ENC), ); } } catch (AeMySQLException $e){ b12f6($e,'Could not get tags matching the search query'); } $c4dd42=l163d(' ',$parameters['query']); if(SEARCH_USE_ROSE){ $dfce9c=new PorterStemmerRussian(new PorterStemmerEnglish()); foreach ($c4dd42 as $d8ce4b => $t9e366){ $c4dd42[$d8ce4b]=$dfce9c -> stemWord($c4dd42[$d8ce4b]); } } $g8e830=array(); $b5d481=we852(); if(SEARCH_USE_ROSE){ try { $fddece=a476c(); $q5b9bd=new Finder($fddece,$dfce9c); $q5b9bd -> setHighlightTemplate('<mark>%s</mark>'); $lf7de9=new Query($b1b1cc); $lf7de9 -> setLimit(SEARCH_LIMIT); $resultSet=$q5b9bd -> find($lf7de9); foreach($resultSet -> getFoundExternalIds() as $w0e684){ if ($w0e684[0]=='n'){ $y21158=substr($w0e684,1); $saad65=i4627($y21158); if (!empty ($_config['search_favourites_boost'])) { if ($saad65['IsFavourite']) { $resultSet->setRelevanceRatio($w0e684,$_config['search_favourites_boost']); } } } } $snippetBuilder=new SnippetBuilder($dfce9c); $snippetBuilder -> setSnippetLineSeparator('  '); $snippetBuilder -> attachSnippets($resultSet, function (array $dbf516){ $result=array(); foreach(array_slice($dbf516,0,SEARCH_SNIPPETS_LIMIT) as $w0e684){ if ($w0e684[0]=='n'){ $y21158=substr($w0e684,1); $w39a37=@i4627($y21158); if ($w39a37){ $w39a37['_']['_id']=$y21158; $saad65=o6791($w39a37); $result[$w0e684]=$saad65['text']; } } } return$result; }); foreach($resultSet -> getItems() as $w0e684 => $r447b7){ if ($w0e684[0]=='n'){ $y21158=substr($w0e684,1); $saad65=i4627($y21158); $saad65['_']['_id']=$y21158; $saad65['_']['_srprovider']='rose'; $saad65['_']['_rose_relevance']=$r447b7 -> getRelevance(); $saad65['_']['_rose_title']=$r447b7 -> getHighlightedTitle($dfce9c); $saad65['_']['_rose_snippet']=$r447b7 -> getSnippet(); if ($saad65['IsPublished'] and yb44b($saad65,$b5d481)) { $g8e830[] = $saad65; } } } if (@$_config['dev_rose_info']) { $s1e441=print_r($resultSet -> getTrace(),true); } } catch (EmptyIndexException $e){ b12f6($e,'Rose index is empty'); } catch (AeMySQLException $e){ b12f6($e,'Could not do something with the database while working on Rose search results'); } } if(SEARCH_USE_MYSQL){ $n36a38=a7928(preg_quote($b1b1cc)); $web31b=( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 AND MATCH (`Title`, `Text`) AGAINST ('". $n36a38 ."')". w6f32($b5d481). "LIMIT ". SEARCH_LIMIT ); try { u0738( $web31b, 'search using MySQL fulltext search' ); $result=d0d6b(); foreach($result as $d8ce4b => $saad65){ $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_srprovider']='mysql'; $g8e830[] = $saad65; } } catch (AeMySQLException $e){ b12f6($e,'Could not search using MySQL fulltext search'); } } $qfbdf2=array(); $z4358b=array(); $f865c0=0; foreach ($g8e830 as $w39a37){ if (!in_array($w39a37['ID'],$qfbdf2)) { $saad65=o6791($w39a37); if (@$saad65['_']['_rose_title']) { $saad65['title']=$saad65['_']['_rose_title']; } else { $saad65['title']=i4c2d($saad65['title'],$c4dd42); } $saad65['title']=u6f10($saad65['title']); if (@$saad65['_']['_rose_snippet']) { $saad65['text']='<p>'. $saad65['_']['_rose_snippet'] .'</p>'; } else { $a1cb25=$saad65['text']; $a1cb25=preg_replace('/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/i','',$a1cb25); $a1cb25=preg_replace('/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/i','',$a1cb25); $a1cb25=str_replace( array ( '<br>', '<br/>', '<br />', '</h1>', '</h2>', '</h3>', '</h4>', '</h5>', '</h6>', '</p>', '</pre>', '</blockquote>', '</li>', ), ' ', $a1cb25 ); $a1cb25=strip_tags($a1cb25); $gad7ba=array(); $u9cc49=preg_split('/[\\n\(\)\[\]]|[.:;?!](\s|$)/uis',$a1cb25); $j363b1=0; $x02db3=''; foreach ($u9cc49 as $md866f){ $md866f=trim($md866f); if (!$md866f) continue; if (!$x02db3)$x02db3=$md866f; $g870c2=$md866f; $g870c2=i4c2d($g870c2,$c4dd42); if ($g870c2!=$md866f){ $gad7ba[] = u48d8($g870c2); $j363b1 ++; if ($j363b1 > 3) break; } } if(count($gad7ba)) { $saad65['text']='<p>'. implode('  ',$gad7ba) .'</p>'; } else { $saad65['text']='<p>'. $x02db3 .'</p>'; } } $saad65['has-highlighed-thumbs?']=false; if ($y55b55=@$saad65['format-info']['resources-detected']) { $u750fa=b2e82($y55b55); foreach ($u750fa as $d8ce4b => $t9e366){ $u750fa[$d8ce4b]['highlighted?'] = ( strstr($t9e366['original-filename'],$b1b1cc)!==false ); if ($u750fa[$d8ce4b]['highlighted?']) { $saad65['has-highlighted-thumbs?']=true; } } $saad65['thumbs']=$u750fa; } $z4358b[] = $saad65; $qfbdf2[] = $w39a37['ID']; $f865c0 ++; if ($f865c0 >= SEARCH_LIMIT) break; } } $ifbb44=count($z4358b); if ($ifbb44){ $l5cde2=e2l_get_string( 'pt--n-posts', array ('number' => $ifbb44) ); } else { $l5cde2=$_strings['pt--no-posts']; $r2cb9d['nothing']=$_strings['gs--nothing-found']; } if ($f865c0 >= SEARCH_LIMIT){ $l5cde2=$_strings['gs--many-posts']; } if ($b11128){ $r2cb9d['search-related-tag']=$b11128; } $r2cb9d['notes']=$z4358b; $r2cb9d['pages'] = array (); $r2cb9d['title']=$l5cde2 .' '. $_strings['gs--found-for-query'] .': '. htmlspecialchars($b1b1cc,ENT_NOQUOTES,HSC_ENC); $r2cb9d['superheading']=$l5cde2 .' '. $_strings['gs--found-for-query']; $r2cb9d['heading']=$b1b1cc; if (@$s1e441){ $r2cb9d['rose-debug-info']=$s1e441; } return $r2cb9d; } function a5070($parameters){ if(Log::$ned2b5)__log('Search form'); $b1b1cc=trim((string) @$parameters['query']); return [ 'form-action' => x83c8('e2s_search'), 'query' => htmlspecialchars($b1b1cc,ENT_COMPAT,HSC_ENC), ]; } function e2s_search(){ $b1b1cc=@$_POST['query']; $b1b1cc=str_replace('?',urlencode('?'),$b1b1cc); $b1b1cc=str_replace('/',' ',$b1b1cc); $b1b1cc=trim($b1b1cc); $b1b1cc=str_replace(' ','+',$b1b1cc); e2_go_to(x83c8('e2m_found', array ('query' => $b1b1cc))); die; } function e2s_bsi_status(){ global$_db,$_config; echo '<pre>'; echo '/@bsi/step/  Make one step of indexing<br />'; echo '/@bsi/drop/  Drop indexes<br /><br />'; $se1fab=@unserialize(file_get_contents(USER_FOLDER.'indexing.psa')); if (!is_array($se1fab))$se1fab=array ('spent' => '?'); $l34421=$we0d69=$yd1647='?'; try { u0738( "SELECT count(*) c FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ", 'count total published notes' ); $s9b207=d0d6b(); $l34421=$s9b207[0]['c']; u0738( "SELECT count(*) c FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsIndexed`=1 AND `IsPublished`=1 ", 'count indexed published notes' ); $s9b207=d0d6b(); $we0d69=$s9b207[0]['c']; $yd1647=round($we0d69/$l34421*100); echo 'Indexed '. $we0d69 .' notes of '. $l34421 .' ('. $yd1647 .'%)<br />'; echo 'Spent '. $se1fab['spent'] .' s (or more)'; } catch (AeMySQLException $e){ b12f6($e,'Could not count some notes'); echo 'DB unaccessible'; } die ('</pre>'); } function e2s_bsi_step(){ global$_db,$_config,$_strings; echo '<pre>'; if($_config['log_bsi']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('bsi'); } if(Log::$ned2b5)__log('BSI step'); if (!u3b97()) { if(Log::$ned2b5)__log('Not indexing'); die ('Not indexing</pre>'); } $se1fab=@unserialize(file_get_contents(USER_FOLDER.'indexing.psa')); if (!is_array($se1fab))$se1fab=array ('spent' => '?'); if ( !isset ($se1fab['lock']) or $se1fab['lock'] < time() - (BSI_GIVE_UP_TIMEOUT+BSI_UNLOCK_TIMEOUT) ) { if (isset ($se1fab['lock'])) { if(Log::$ned2b5)__log('Indexer: old lock is '. $se1fab['lock']); echo 'Old lock is '. $se1fab['lock'] .'<br />'; } else { echo 'No old lock<br />'; } $se1fab['lock']=time(); if (!@k6e52(USER_FOLDER.'indexing.psa',serialize($se1fab))) { if(Log::$ned2b5)__log('Indexer: cant get a new lock'); die ('Cant get a new lock<br />'); } if(Log::$ned2b5)__log('Indexer: new lock is '. $se1fab['lock']); echo 'New lock is '. $se1fab['lock'] .'<br /><br />'; try { $f865c0=0; $h680a2=0; $uce2fc=v7f78(); $f30d94=false; while ($h680a2 < BSI_GIVE_UP_TIMEOUT){ u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsIndexed`=0 AND `IsPublished`=1 ". "ORDER BY `Stamp` DESC ". "LIMIT ". BSI_SELECT_PORTION, 'get portion of unindexed notes for indexing' ); $s9b207=d0d6b(); if(count($s9b207)) { ++ $f865c0; if(Log::$ned2b5)__log('Indexer: portion '. $f865c0); echo 'Portion '. $f865c0 .'<br />'; foreach ($s9b207 as $oea59a){ if(Log::$ned2b5)__log('Indexer: indexing "'. $oea59a['Title'].'"'); echo 'Indexing: '. $oea59a['Title'] .'<br />'; if (vd2e1($oea59a)) { $oea59a['IsIndexed']='1'; qaa79('Notes',$oea59a); } if($_config['broadcast_on_indexing']) { ueb3b($oea59a); } } $h680a2=round(v7f78()-$uce2fc,3); if(Log::$ned2b5)__log('Indexer: step done '. count($s9b207) .', spent '. $h680a2 .' ms so far'); echo 'Step done '. count($s9b207) .', spent '. $h680a2 .' ms so far<br /><br />'; if(Log::$ned2b5)__log($e78e62); } else { $f30d94=true; break; } } if ($f30d94){ if(Log::$ned2b5)__log('Indexer: indexing complete'); echo 'Indexing complete<br /><br />'; @unlink(USER_FOLDER.'indexing.psa'); } else { echo 'Time out<br />'; unset ($se1fab['lock']); $se1fab['done']=count($s9b207); if ($se1fab['spent']!='?')$se1fab['spent']+=$h680a2; @k6e52(USER_FOLDER.'indexing.psa',serialize($se1fab)); } } catch (AeMySQLException $e){ b12f6($e,'Could not index notes'); if(Log::$ned2b5)__log('Indexer: DB unaccessible'); echo 'DB unaccessible<br />'; } } else { if(Log::$ned2b5)__log('Indexer: locked'); echo 'Locked<br />'; } die ('</pre>'); } function e2s_bsi_drop(){ global$_db,$_config; try { echo '<pre>'; ha521(); echo 'All notes marked for reindexing<br />'; $fddece=a476c(); try { $fddece -> erase(); echo 'Indexes dropped<br />'; } catch (\S2\Rose\Exception\RuntimeException $e){ b12f6($e,'Rose threw RuntimeException'); } c198f(); die ('</pre>'); } catch (AeMySQLException $e){ b12f6($e,'Could not make all notes for reindexing'); die ('<pre>DB unaccessible</pre>'); } } function c198f(){ $se1fab=array(); @k6e52(USER_FOLDER.'indexing.psa',serialize($se1fab)); } function u3b97(){ return (is_file(USER_FOLDER.'indexing.psa')); } function vd2e1($w39a37){ if(Log::$ned2b5)__log('Indexer: index noterec'); static $gf4540=null; try { if ($gf4540===null){ $dfce9c=new PorterStemmerRussian(new PorterStemmerEnglish()); $gf4540=new Indexer(a476c(),$dfce9c); } $o2bfe4=j154e($w39a37['FormatterID'], @$w39a37['Text'],'full-rss'); afc4d($w39a37,$o2bfe4); $a1cb25=strip_tags($o2bfe4['text-final']); $z3e961=new Indexable( 'n'. $w39a37['ID'], $w39a37['Title'], $a1cb25 ); $gf4540 -> index($z3e961); return true; } catch (\Exception $e){ return false; } } function s10fe($xb80bb){ static $gf4540=null; try { if ($gf4540===null){ $dfce9c=new PorterStemmerRussian(new PorterStemmerEnglish()); $gf4540=new Indexer(a476c(),$dfce9c); } return $gf4540 -> removeById('n'. $xb80bb); } catch (\Exception $e){ return false; } } function n713e($ra2f2e){ $e851f5='S2\\Rose\\'; $e32fcc=__DIR__.'/library/rose/'; $tf5a8e=strlen($e851f5); if(strncmp($e851f5,$ra2f2e,$tf5a8e)!==0) return; $pe1cb9=substr($ra2f2e,$tf5a8e); $d8c7dd=$e32fcc.str_replace('\\','/',$pe1cb9).'.php'; if(file_exists($d8c7dd)) require $d8c7dd; } function kd372(){ return array ( 'TOC' => 'Contents', 'WORD' => 'Word', 'FULLTEXT_INDEX' => 'Fulltext', 'KEYWORD_INDEX' => 'Keyword', 'KEYWORD_MULTIPLE_INDEX' => 'KeywordMultiple', ); } function a476c(){ global$_config,$settings; static $x88131=null; if ($x88131===null and SEARCH_USE_ROSE){ $pcf66e=new \PDO( 'mysql:'. 'host='. $settings['db']['server'] .';'. 'dbname='. $settings['db']['name'], $settings['db']['user_name'], iee85($settings['db']['passw']) ); $x2af72=$pcf66e -> getAttribute(\PDO::ATTR_SERVER_VERSION); $q84bea=version_compare($x2af72,'5.5.3','>=')?'utf8mb4':'utf8'; $pcf66e -> exec('SET NAMES '.$q84bea); $pcf66e -> setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $x44b61=kd372(); $x88131=new PdoStorage( $pcf66e, $_config['db_table_prefix'].SEARCH_EXTRA_PREFIX, array ( PdoStorage::TOC => $x44b61['TOC'], PdoStorage::WORD => $x44b61['WORD'], PdoStorage::FULLTEXT_INDEX => $x44b61['FULLTEXT_INDEX'], PdoStorage::KEYWORD_INDEX => $x44b61['KEYWORD_INDEX'], PdoStorage::KEYWORD_MULTIPLE_INDEX => $x44b61['KEYWORD_MULTIPLE_INDEX'], ) ); } return $x88131; } function i4c2d($a1cb25,$c4dd42){ foreach ($c4dd42 as $o2510c){ if ($o2510c=='-') continue; $o2510c=preg_quote($o2510c,'/'); $o2510c=str_replace('','[]',$o2510c); $o2510c=str_replace('','[]',$o2510c); $a1cb25=preg_replace('/(?<=^|\W)('.$o2510c.'[\w\p{M}]*)/iu','<mark>$1</mark>',$a1cb25); } $a1cb25=str_replace('</mark><mark>',' ',$a1cb25); $a1cb25=str_replace('</mark> <mark>',' ',$a1cb25); return $a1cb25; } function u48d8($w341be){ $ge05fe=mb_strtoupper(mb_substr($w341be,0,1)); return $ge05fe.mb_substr($w341be,1); } function ha521(){ global$_config; u0738( "UPDATE `". $_config['db_table_prefix']."Notes` ". "SET `IsIndexed`=0 ". "WHERE `SubsetID`=". $_config['db_table_subset'], 'mark all notes for reindexing' ); } function e2_check_timeout(){ static $g90272; if(is_null($g90272)) { $ef48ef=ini_get('max_execution_time'); if ($ef48ef){ $g90272=time()+$ef48ef-5; } else { $g90272=0; } } return ($g90272==0)?true:$g90272 >= time(); } function e2_write_dump_header($d8c7dd){ $q099fb=( 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' .PHP_EOL. 'SET AUTOCOMMIT=0;' .PHP_EOL. 'START TRANSACTION;' .PHP_EOL. "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;" .PHP_EOL. "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;" .PHP_EOL. "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;" .PHP_EOL. "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;" .PHP_EOL. "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;" .PHP_EOL. "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;" .PHP_EOL. "/*!40101 SET NAMES utf8 */;" .PHP_EOL. "/*!50503 SET NAMES utf8mb4 */;" .PHP_EOL. '' ); fwrite($d8c7dd,$q099fb); return true; } function e2_write_dump_footer($d8c7dd){ $s251d1='COMMIT;' .PHP_EOL; $s251d1 .= "/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;" .PHP_EOL ."/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;" .PHP_EOL ."/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;" .PHP_EOL ."/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;".PHP_EOL ."/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;" .PHP_EOL ."/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;" .PHP_EOL; fwrite($d8c7dd,$s251d1); return true; } function e2_get_table_definition($v0c1d0,$oaab9e){ $w5c286=null; $result=mysqli_query($v0c1d0,"SHOW CREATE TABLE `{$oaab9e}`"); if($result){ $u47c80=mysqli_fetch_array($result); $w5c286=$u47c80['Create Table']; } return $w5c286; } function e2_write_table_definition($d8c7dd,$v0c1d0,$oaab9e){ $u30618=e2_get_table_definition($v0c1d0,$oaab9e); if(e2_check_timeout() && $u30618){ fwrite($d8c7dd,$u30618); fwrite($d8c7dd,';'); fwrite($d8c7dd,PHP_EOL.PHP_EOL); return true; } return false; } function e2_get_table_data($v0c1d0,$oaab9e,$v7a86c,$maa9f7){ $b1b1cc="SELECT * FROM `{$oaab9e}` LIMIT {$v7a86c}, {$maa9f7}"; $result=mysqli_query($v0c1d0,$b1b1cc); if (!$result){ return false; } $y66e9c=''; $b3c41a="INSERT INTO `{$oaab9e}` VALUES"; while ($mf1965=mysqli_fetch_assoc($result)) { $n691d5=array(); foreach($mf1965 as $w2063c){ $n691d5[] = is_null($w2063c)?"NULL":"'".mysqli_real_escape_string($v0c1d0,$w2063c)."'"; } $y66e9c.=$b3c41a.'('.join(', ',$n691d5).');'.PHP_EOL; } return $y66e9c; } function e2_table_disable_keys($oaab9e){ return "ALTER TABLE `{$oaab9e}` DISABLE KEYS;".PHP_EOL; } function e2_table_enable_keys($oaab9e){ return "ALTER TABLE `{$oaab9e}` ENABLE KEYS;".PHP_EOL; } function e2_get_total_records($v0c1d0,$oaab9e){ $d8ce4b=mysqli_fetch_row(mysqli_query($v0c1d0,"SELECT COUNT(*) FROM `{$oaab9e}`")); return $d8ce4b[0]; } function e2_write_table_data($d8c7dd,$v0c1d0,$oaab9e){ $ifbb44=e2_get_total_records($v0c1d0,$oaab9e); $v7a86c=0; $maa9f7=1000; $result=true; $h47495=20000; $x80fc1=30; if ($ifbb44){ $efbda5=e2_table_disable_keys($oaab9e); fwrite($d8c7dd,$efbda5); } $y66e9c="INSERT INTO `{$oaab9e}` VALUES"; $wde57a=$ifbb44; while ($wde57a > 0){ $b1b1cc="SELECT * FROM `{$oaab9e}` LIMIT {$v7a86c}, {$maa9f7}"; $result=mysqli_query($v0c1d0,$b1b1cc); $wb428d=mysqli_num_rows($result); if (!$result || !e2_check_timeout()) { $result=false; break; } $cdf347=array(); $d4b3a6=0; $gb6539=0; while ($mf1965=mysqli_fetch_assoc($result)) { if (!e2_check_timeout()) { $result=false; break; } $wb428d--; $i54ca8=array(); foreach($mf1965 as $w2063c){ $i54ca8[] = is_null($w2063c)?"NULL":"'".mysqli_real_escape_string($v0c1d0,$w2063c)."'"; } $s8d777='('.join(', ',$i54ca8).')'; $d4b3a6+=strlen($s8d777); $cdf347[] = $s8d777; $gb6539++; if ( ($d4b3a6 >= $h47495) || ($gb6539 >= $x80fc1) || ($wb428d==0)) { $b1b1cc=$y66e9c.join(', ',$cdf347).';'; fwrite($d8c7dd,$b1b1cc); fwrite($d8c7dd,PHP_EOL); $d4b3a6=0; $gb6539=0; $cdf347=array(); } } $v7a86c+=$maa9f7; $wde57a -= $maa9f7; } if ($ifbb44){ $t6bfc4=e2_table_enable_keys($oaab9e); fwrite($d8c7dd,$t6bfc4); } return$result; } function e2_backup($v0c1d0,$u9ab2e,$va9745,$n93da6=array()) { $c2beda=tmpfile(); e2_write_dump_header($c2beda); if(Log::$ned2b5)__log('Backup: wrote header'); $e75101=true; foreach($u9ab2e as $oaab9e){ if(Log::$ned2b5)__log('Backup: table '. $oaab9e); $s91e7e=e2_write_table_definition($c2beda,$v0c1d0,$oaab9e); if(Log::$ned2b5)__log('Backup: wrote table definition with result '. (int)$s91e7e); $d35285=e2_write_table_data($c2beda,$v0c1d0,$oaab9e); if(Log::$ned2b5)__log('Backup: wrote table data with result '. (int)$d35285); $e75101=$s91e7e && $d35285; if ($e75101===false){ break; } } if(Log::$ned2b5)__log('Backup: wrote data with running == '. (int)$e75101); if ($e75101){ e2_write_dump_footer($c2beda); fseek($c2beda,0); $d8c7dd=fopen($va9745,'w+'); while ($e75101 && ($s8d777=fread($c2beda,1024))) { if(e2_check_timeout()) { fwrite($d8c7dd,$s8d777); } else { $e75101=false; } } fclose($d8c7dd); } fclose($c2beda); return $e75101; } function n3e5c($e0c426,$content){ $y52766=MTMPL_FOLDER.$e0c426 .'.mtmpl.php'; if(is_file($y52766)) { ob_start(); include $y52766; $ade7a3=ob_get_contents(); ob_end_clean(); return trim($ade7a3); } } function daed2(){ global$_config,$_superconfig; $j9e35a=$_config['mail_from']; if (@$_superconfig['mail_from']) { $j9e35a=$_superconfig['mail_from']; } if ($j9e35a[strlen($j9e35a)-1]=='@'){ $j9e35a.=$_SERVER['HTTP_HOST']; } return $j9e35a; } function fa41b($j01b6e,$subject,$m78e73,$p145a2=''){ global$_superconfig; if (@$_superconfig['mail_debug']) { $y85114='mail-debug'; $x8fa14=basename(tempnam($y85114,'m-')); $a1cb25=( 'To:       '.$j01b6e ."\n". 'Subject:  '.$subject ."\n". $p145a2 ."\n". "--------------------------------------------------\n". $m78e73 ); k6e52($y85114 .'/'. $x8fa14,$a1cb25); chmod($y85114 .'/'. $x8fa14,E2_NEW_FILES_RIGHTS); rename($y85114 .'/'. $x8fa14,$y85114 .'/'. $x8fa14.'.txt'); } $subject='=?UTF-8?B?'. base64_encode($subject) .'?='; $p145a2.="\r\nContent-Type: text/plain; charset=utf-8"; mail($j01b6e,$subject,$m78e73,trim($p145a2)); } function _A($a1cb25){ global$_candy,$_protocol,$x57de2,$ra57c1,$_current_url; if ( preg_match('/\<a href\=\"(.*?)\"[^>]*\>(.*?)\<\/a\>/si',$a1cb25,$j9c28d) and ( $j9c28d[1]==='' or $j9c28d[1]===$_current_url or $_protocol .'://'. $x57de2.$j9c28d[1]===$_current_url or $_protocol .'://'. $x57de2.$ra57c1 .'/'. $j9c28d[1]===$_current_url or $_candy=='e2m_install' ) ) { return $j9c28d[2]; } else { return $a1cb25; } } function _AT($xe8fab){ global$_candy,$x57de2,$ra57c1,$_current_url; return ( $xe8fab==='' or $xe8fab===$_current_url or $_protocol .'://'. $x57de2.$xe8fab===$_current_url or $_protocol .'://'. $x57de2.$ra57c1 .'/'. $xe8fab===$_current_url ); } function _IMGSRC($j435ed){ return b1492($j435ed); } function _SVG($j435ed){ return kf42c($j435ed); } function _COLOR($bf97c5,$ob8a9f,$icc321,$y4efa2=1){ if(strlen($bf97c5)!=3 and strlen($bf97c5)!=6) return 'f0f'; if(strlen($ob8a9f)!=3 and strlen($ob8a9f)!=6) return 'f0f'; if(strlen($bf97c5)==3)$bf97c5=$bf97c5[0].$bf97c5[0].$bf97c5[1].$bf97c5[1].$bf97c5[2].$bf97c5[2]; if(strlen($ob8a9f)==3)$ob8a9f=$ob8a9f[0].$ob8a9f[0].$ob8a9f[1].$ob8a9f[1].$ob8a9f[2].$ob8a9f[2]; $zf09cc=array ( $bf97c5[0].$bf97c5[1],$bf97c5[2].$bf97c5[3],$bf97c5[4].$bf97c5[5], $ob8a9f[0].$ob8a9f[1],$ob8a9f[2].$ob8a9f[3],$ob8a9f[4].$ob8a9f[5], ); foreach ($zf09cc as $d8ce4b => $t9e366){ $zf09cc[$d8ce4b]=hexdec($t9e366); } $q22af6=array ( $zf09cc[0]+pow($icc321,$y4efa2) * ($zf09cc[3]-$zf09cc[0]), $zf09cc[1]+pow($icc321,$y4efa2) * ($zf09cc[4]-$zf09cc[1]), $zf09cc[2]+pow($icc321,$y4efa2) * ($zf09cc[5]-$zf09cc[2]), ); $n70dda=''; foreach ($q22af6 as $d8ce4b => $t9e366){ $n70dda.=str_pad(dechex($t9e366),2,'0',STR_PAD_LEFT); } return $n70dda; } function _DT($n1ddcb,$cb35c6){ if (!$cb35c6) return ''; list ($k96b8c,$mb2c6c)=$cb35c6; $r2cb9d=$n1ddcb; $n7436f=h5a2f('m',$k96b8c,$mb2c6c); $r2cb9d=str_replace('{zone}',e2__escape_all(f9515($mb2c6c['offset'])), $r2cb9d); $r2cb9d=str_replace('{month}',e2__escape_all(e2l_get_string('um--month', array ('month' => $n7436f))), $r2cb9d); $r2cb9d=str_replace('{month-short}',e2__escape_all(e2l_get_string('um--month-short', array ('month' => $n7436f))), $r2cb9d); $r2cb9d=str_replace('{month-g}',e2__escape_all(e2l_get_string('um--month-g', array ('month' => $n7436f))), $r2cb9d); $r2cb9d=h5a2f($r2cb9d,$k96b8c,$mb2c6c); return $r2cb9d; } function _AGO($cb35c6){ return y9093($cb35c6[0], array ('offset' => $cb35c6[1]['offset'],'is_dst' => $cb35c6[1]['is_dst']) ); } function _NUM($a1cb25){ return e2_decline_for_number($a1cb25); } function _FIRST($p437b9){ return ($p437b9['_']['_ord']==0); } function _LAST($p437b9){ return ($p437b9['_']['_ord']==$p437b9['_']['_ord_max']); } function _CSS($ic7a62){ return hd4c1($ic7a62); } function _CSS_HREF($ic7a62){ return h576f($ic7a62); } function _JS($r32981){ return xd00a($r32981); } function _LIB($be8acc){ return v16f0($be8acc); } function _T($b52678){ return q166b($b52678); } function _T_DEFER($vb0689){ return tab71($vb0689); } function _X($b52678){ return a6a97($b52678); } function _T_FOR($b52678,$yd5566=null){ global$content; if ($yd5566===null)$yd5566=$b52678; if(array_key_exists($yd5566,$content)) { q166b($b52678); } } function _GUIDES($eeca07=false){ global$_olba_guides; if(is_array($eeca07))$_olba_guides=$eeca07; if (!is_array($_olba_guides)) return; $y88408='<div style="position: fixed; width: 100%; height: 100%; z-index: -100">'; $r1d623=0; $x07d43=$_olba_guides; $x07d43[] = 100; foreach ($x07d43 as $f865c0 => $id89e2){ if ($id89e2==100) break; $r1d623+=$id89e2; $y88408.='<div style="position: fixed; left: '. $id89e2 .'%; width: 0; height: 100%; border-left: 1px #000 dotted; opacity: .2; -webkit-opacity: .2; -moz-opacity: .2"></div>'; $za1b01='position: absolute; padding: 2px 3px; top: 0; font-size: 9px; background: #ccc; color: #000; font-family: "Verdana", sans-serif; opacity: .8; -webkit-opacity: .8; -moz-opacity: .8'; if ($x07d43[$f865c0+1]-$x07d43[$f865c0] < 4){ $y88408.='<div style="'. $za1b01.'; right: '. (100-$id89e2) .'%; border-bottom-left-radius: .5em; -webkit-border-bottom-left-radius: .5em; -moz-border-bottom-left-radius: .5em;">'. $id89e2 .'%</div>'; } else { $y88408.='<div style="'. $za1b01.'; left: '. $id89e2 .'%; border-bottom-right-radius: .5em; -webkit-border-bottom-right-radius: .5em; -moz-border-bottom-right-radius: .5em;">'. $id89e2 .'%</div>'; } } $y88408.='</div>'; $_olba_current_col=0; return $y88408; } function _S($fb45cf){ global$_strings; return$_strings[$fb45cf]; } function _SHORTCUT($vb0689){ return xbb8d($vb0689); } function e2__escape_all($fb45cf){ $r2cb9d=''; for ($f865c0=0; $f865c0 < mb_strlen($fb45cf); ++ $f865c0){ $r2cb9d.='\\'. mb_substr($fb45cf,$f865c0,1); } return $r2cb9d; } abstract class E2GIP { protected $gip_cookie_name='gip'; protected $gip_token_cookie_name='gip_access_token'; protected $gip_token=null; abstract public function get_auth_url(); abstract public static function get_profile_url($xb80bb,$q2a304); abstract public function callback(); const PHP_VERSION_VK_FEATURE=70100; public static function set_session_data($b3c6e0,$w2063c){ if(session_status()==PHP_SESSION_NONE){ session_start(); } $_SESSION[$b3c6e0]=$w2063c; } public static function get_session_data($b3c6e0,$ne2181=false){ if(session_status()==PHP_SESSION_NONE){ session_start(); } if(!isset($_SESSION[$b3c6e0])) { return null; } $w2063c=$_SESSION[$b3c6e0]; if($ne2181){ unset($_SESSION[$b3c6e0]); } return $w2063c; } public static function get_gips_order(){ return [ 'twitter' => 0, 'facebook' => 1, 'vk' => 2 ]; } public function get_config($b3c6e0){ $icbb14='gips/'. $this->type .'.json'; if(is_file(USER_FOLDER.$icbb14)) { $z466de=@file_get_contents(USER_FOLDER.$icbb14); } else { $z466de=@file_get_contents(SYSTEM_FOLDER.$icbb14); } if ($z466de!==false){ $r2cb9d=json_decode($z466de,true,512,JSON_BIGINT_AS_STRING)[$b3c6e0]; if ($r2cb9d) return $r2cb9d; } return null; } public function get_callback_url(){ return x83c8('e2m_gip_sign_in_callback', array('provider' => $this->type)); } protected function get_proxy_param(){ global$settings; $m75725=DEFAULT_LANGUAGE; if(array_key_exists('language',$settings))$m75725=$settings['language']; return '?language='.$m75725.'&type='.$this->type.'&callback_url='.urlencode($this->get_callback_url()); } public function get_gip_session_data(){ global$_config; $b94a08=$this->gip_token?$this->gip_token:$_COOKIE[v8c3b($this->gip_token_cookie_name)]; u0738( "SELECT * FROM `". $_config['db_table_prefix']."GIPsSessions` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `GIP` = '". $this->type ."' ". "AND `SessionToken` = '".a7928($b94a08)."' ". "ORDER BY `ID` DESC LIMIT 1", 'get GIP session data' ); $result=d0d6b(); return$result?$result[0] : array(); } public function is_logged_in(){ if(empty($_COOKIE[v8c3b($this->gip_cookie_name)]) || !in_array($_COOKIE[v8c3b($this->gip_cookie_name)], e2_list_gips()) || $_COOKIE[v8c3b($this->gip_cookie_name)] != $this->type || empty($_COOKIE[v8c3b($this->gip_token_cookie_name)])) { return false; } $s8d777=$this->get_gip_session_data(); return (bool)$s8d777; } protected function save_session($xb80bb,$vb0689,$accessToken,$tb974d='',$userEmail='',$userLink=''){ $k96b8c=time(); v9943( 'GIPsSessions', array ( 'GIP' => $this->type, 'GIPAuthorID' => $xb80bb, 'AuthorName' => $vb0689, 'AuthorEmail' => $userEmail, 'AuthorProfileLink' => $userLink, 'SessionToken' => $accessToken, 'Stamp' => $k96b8c, ), 'INSERT', 'ON DUPLICATE KEY UPDATE '. '`SessionToken` = "'.a7928($accessToken).'", '. '`AuthorName` = "'.a7928($vb0689).'", '. '`Stamp` = "'.$k96b8c.'"' ); ic64a($this->gip_cookie_name,$this->type); ic64a($this->gip_token_cookie_name,$accessToken); if(isset($userEmail) && !empty($userEmail))ic64a('commenter_email',$userEmail); $this->gip_token=$accessToken; } public static function get_logout_key(){ if ($f4a73c=self::get_session_data('logout_key')) { return $f4a73c; } $f4a73c=md5(microtime()); self::set_session_data('logout_key',$f4a73c); return $f4a73c; } public static function is_valid_logout_key($b3c6e0){ $yeb1de=self::get_session_data('logout_key',true); if (empty($yeb1de) || empty($b3c6e0) || $yeb1de!=$b3c6e0){ return false; } return true; } public function logout(){ global$_config; ic64a($this->gip_cookie_name); ic64a($this->gip_token_cookie_name); u0738( "DELETE FROM `". $_config['db_table_prefix']."GIPsSessions` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `GIP` = '".$this->type."' ". "AND `SessionToken` = '" . a7928($_COOKIE[v8c3b($this->gip_token_cookie_name)]) . "'", 'logout' ); } public function get_avatar_width(){ return USERPIC_WIDTH; } public function get_avatar_height(){ return USERPIC_HEIGHT; } public function save_avatar($xb80bb,$p3d02b){ global$_config; @eaf42(MEDIA_ROOT_FOLDER.AVATARS_FOLDER); @chmod(MEDIA_ROOT_FOLDER.AVATARS_FOLDER,$_config['uploaded_files_mode']); $j435ed=MEDIA_ROOT_FOLDER.AVATARS_FOLDER.$this->type .'-'. $xb80bb .'.jpg'; if ($n5b860=file_get_contents($p3d02b)) { file_put_contents($j435ed,$n5b860); } return $j435ed; } } function e2m_gip_sign_in($s8d777){ global$_config,$settings; $type=$s8d777['provider']; $c7123a=e2_get_gip_instance($type); if (!$c7123a){ j4930(); die; } header('Location: '.$c7123a->get_auth_url()); die; } function e2m_gip_sign_in_callback($s8d777){ global$_config; $type=$s8d777['provider']; $c7123a=e2_get_gip_instance($type); if (!$c7123a){ die($type.' is not defined'); } $g73797=$c7123a->callback(); echo '<script>'; if ($g73797===true){ $ja64f4=$c7123a->get_gip_session_data(); $x78506=[ 'name' => $ja64f4['AuthorName'], 'gipIcon' => _SVG($type), 'logoutUrl' => x83c8('e2m_gip_sign_out', array('provider' => E2GIP::get_logout_key())), ]; echo 'window.opener.oauthAuthorized('.json_encode($x78506).');'; } else { echo 'alert (\''. $g73797. '\');'; } echo 'window.close();</script>'; die; } function e2m_gip_sign_out($s8d777){ global$_config; $f4a73c=$s8d777['provider']; if (!E2GIP::is_valid_logout_key($f4a73c)) { die('invalid logout key'); } $c7123a=e2_get_logged_gip(); if($c7123a){ $c7123a->logout(); } j4930(); die; } function e2_list_gips(){ static $y2d168=null; if(!is_null($y2d168)) { return $y2d168; } $q1c05f=SYSTEM_FOLDER. 'gips/'; $r700f6=opendir($q1c05f); $y2d168=[]; $f965d3=E2GIP::get_gips_order(); $cf5f73=count($f965d3); while (($d8c7dd=readdir($r700f6)) !== false){ if(pathinfo($d8c7dd,PATHINFO_EXTENSION)!='php') continue; $c77dca=pathinfo($d8c7dd,PATHINFO_FILENAME); if ($c77dca=='vk'){ if(PHP_VERSION_ID < E2GIP::PHP_VERSION_VK_FEATURE) continue; } $b3c6e0=isset($f965d3[$c77dca]) ? $f965d3[$c77dca] : ++$cf5f73; $y2d168[$b3c6e0]=$c77dca; } closedir($r700f6); ksort($y2d168); return $y2d168; } function e2_get_gip_class_name($type){ return "E2GIP".ucfirst($type); } function e2_get_gip_instance($type){ if (!in_array($type,e2_list_gips())) { return false; } $u38c9b=e2_get_gip_class_name($type); $c7123a=new $u38c9b; return $c7123a; } function e2_get_gip_auth_url($type){ return x83c8('e2m_gip_sign_in', array('provider' => $type)); } function e2_is_logged_in($type=''){ $qd14a8=!$type?e2_list_gips() : array($type); foreach($qd14a8 as$type){ $c7123a=e2_get_gip_instance($type); if ($c7123a && $c7123a->is_logged_in()) { return true; } } return false; } function e2_get_logged_gip(){ foreach(e2_list_gips() as$type){ $c7123a=e2_get_gip_instance($type); if ($c7123a && $c7123a->is_logged_in()) { return $c7123a; } } return false; } function e2_get_logged_gip_name(){ foreach(e2_list_gips() as$type){ $c7123a=e2_get_gip_instance($type); if ($c7123a && $c7123a->is_logged_in()) { return$type; } } return false; } function e2_get_user_profile_url($type,$xb80bb,$q2a304){ $u38c9b=e2_get_gip_class_name($type); return $u38c9b::get_profile_url($xb80bb,$q2a304); } function e2_get_gip_session($type){ $c7123a=e2_get_gip_instance($type); if (!$c7123a || !$c7123a->is_logged_in()) { return false; } return $c7123a->get_gip_session_data(); } foreach(e2_list_gips() as $z48e15){ require_once 'system/gips/'.$z48e15.'.php'; } define('__DEV', (@$_config['dev_verbose'] > (int) !we852())); $_stopwatch=v7f78($_stopwatch); spl_autoload_register('n713e'); r372b(); r74e0(); $_strings=hfc91(); if(!BUILT) @include 'builder.php'; function e2(){ global$settings,$content, $_candy, $_lang, $_config, $_strings, $_candies_installer, $_candies_public, $_candies_ajax, $_candies_to_disallow_in_read_only, $_template, $_diagnose; oabdd(); set_error_handler('we1c4'); set_exception_handler('maefe'); header('X-Powered-By: E2 Aegea v'. E2_VERSION); header('Content-type: text/html; charset=UTF-8'); list ($uc48ba,$parameters)=sb7e9(); try { $content=[]; $_candy=$uc48ba; if ( @$_config['dev_slow_ajax'] and ( in_array($uc48ba,$_candies_ajax) ) ) { sleep(1+2 * (rand()/getrandmax())); } if (!in_array($uc48ba,$_candies_installer)) { hd660(); } if (@$_config['read_only'] and in_array($uc48ba,$_candies_to_disallow_in_read_only)) { $uc48ba='e2m_error404'; } $p58387=(bool)we852(); $s0b448=!in_array($uc48ba,$_candies_public); if(Log::$ned2b5)__log('User signed in? '. ($p58387? 'Yes':'No')); $_newsfeeds=[]; q3010('rss',n6f51(),x83c8('e2m_rss')); q3010('json',n6f51(),x83c8('e2m_json')); if(substr($uc48ba,0,4)=='e2m_'){ udb82(); } if(is_callable($uc48ba)) { if ($s0b448 && !$p58387){ if(substr($uc48ba,0,4)=='e2s_'){ $content=call_user_func('e2s_sign_in_necessary'); } else { $content['title']=$_strings['pt--sign-in']; } } else { if(Log::$ned2b5)__log('Candy call {'); $content=call_user_func($uc48ba,$parameters); if(Log::$ned2b5)__log('}'); } } else { $s0b448=false; $content=e2_error404_mode(); } } catch (AeMySQLException $e){ if(substr($uc48ba,0,4)=='e2s_'){ q4aff($e); } else { b12f6($e); $parameters=array(); $content['unavailable?']=true; } } if (!is_array($content))$content=array(); if (!array_key_exists('class',$content)) { $content['class']=str_replace('_','-',str_replace('e2m_','',$uc48ba)); } if (!array_key_exists('notes',$content))$content['notes'] = array (); if (!array_key_exists('drafts',$content))$content['drafts'] = array (); if (!array_key_exists('comments',$content))$content['comments'] = array (); if (!array_key_exists('notes-list',$content))$content['notes-list'] = array (); if (n2ac5()!==null){ if(Log::$ned2b5)__log('Stuff for installed engine {'); $content['sign-in'] = [ 'done?' => $p58387, 'required?' => $s0b448, 'necessary?' => $s0b448 && !$p58387, 'href' => x83c8('e2m_sign_in'), 'prompt' => $_strings['gs--need-password'], ]; $content['hrefs'] = array ( 'everything' => x83c8('e2m_everything'), ); if (!array_key_exists('popular',$content)) $content['popular']=o7f52(); if (!array_key_exists('tags',$content)) $content['tags']=ie531($parameters); $content['blog']=t3020(); $content['form-search']=a5070($parameters); $content['form-login']=c126f(); $content['engine']=h29a1(); $content['template']['respond-to-dark-mode?'] = ( $_template['supports_dark_mode'] and (bool) @$settings['appearance']['respond_to_dark_mode'] ); $content['template']['use-likely-light?']=$_template['use_likely_light']; if (!array_key_exists('summary',$content)) { $content['summary']=strip_tags($content['blog']['description']); } if (we852()) { $content['admin']=o5e47(); $content['last-modifieds-by-id']='{}'; if (@$_COOKIE[v8c3b('local_copies')]) { $content['last-modifieds-by-id'] = ( ua2d8($_COOKIE[v8c3b('local_copies')]) ); } } if(Log::$ned2b5)__log('}'); } $content['title']=strip_tags(u6f10(htmlspecialchars($content['title'],ENT_NOQUOTES,HSC_ENC))); if (@$content['heading']) { $content['heading']=strip_tags(u6f10(htmlspecialchars($content['heading'],ENT_NOQUOTES,HSC_ENC))); } $content['language']=$_lang; if (!@isset ($_diagnose['ok?'])) { if (@$_COOKIE[v8c3b('diagnose')] or @$_diagnose['need?']) { k8739(); } } if ( $settings['appearance']['show_view_counts'] and is_array($content['notes']) and count($content['notes']) > 0 ){ $content['notes']=e2_populate_read_counts_in_notes_ctree_($content['notes']); } foreach($content['notes'] as $saad65){ a57ad($saad65['format-info']['links-required']); } $content['message']=u0955(); $e78e62=gbc21(); $content['meta']=rc4da( $uc48ba, $content['notes'], $content['tag'], $content['blog'], $content['pages'] ); $content['stat']=l6442(); $e78e62=y326f($e78e62); $lfa6a9=false; if (n2ac5()!==null and u3b97()) { if(is_writable(USER_FOLDER.'indexing.psa')) { $lfa6a9=true; } else { $_diagnose['need?']=true; ic64a('diagnose','1'); } } echo $e78e62; if (n2ac5()!==null and $lfa6a9){ if(Log::$ned2b5)__log('Spawn BSI step'); gcc38(x83c8('e2s_bsi_step', array ())); } if (@$_config['dev_dump_ctree'])sce80($content); } ?>

Did this file decode correctly?

Original Code

<?php
 $_stopwatch=microtime(); define('E2_VERSION',3572); define('E2_RELEASE','2.9'); define('E2_UA_STRING','E2 (v'. E2_VERSION .'; Aegea)'); define('E2_MINIMUM_PHP','5.4'); define('E2_MINIMUM_MYSQL',4.1); define('BUILDER_OBFUSCATE',1); define('BUILDER_FLATTEN',1); define('E2_NEW_FILES_RIGHTS',0777); define('E2_JSON_STYLE',JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); define('E2_RUN_ID',chr(rand(65,90))); define('HSC_ENC','UTF-8'); define('SECONDS_IN_A_MINUTE',60); define('SECONDS_IN_AN_HOUR',3600); define('SECONDS_IN_A_DAY',86400); define('SECONDS_IN_A_MONTH',2592000); define('SECONDS_IN_A_YEAR',31536000); if(version_compare(PHP_VERSION,E2_MINIMUM_PHP) < 0){ die ('PHP version must be '. E2_MINIMUM_PHP .' or later, you are running '. PHP_VERSION); } if(!function_exists('getimagesize')) { die ('Function getimagesize is not defined, php_gd not installed?'); } if(!function_exists('mb_internal_encoding')) { die ('Function mb_internal_encoding is not defined, php_mbstring not installed?'); } error_reporting(E_ALL); setlocale(LC_CTYPE,'ru_RU.UTF'); mb_internal_encoding('UTF-8'); date_default_timezone_set('GMT'); if(version_compare(PHP_VERSION,'7.0') < 0){ error_reporting(E_ALL & ~E_STRICT); } if(is_file('superconfig.php')) { include 'superconfig.php'; } $_protocol=( !empty ($_SERVER['HTTPS']) && $_SERVER['HTTPS']!=='off' or $_SERVER['SERVER_PORT']==443 or isset ($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO']=='https' or isset ($_SERVER['HTTP_X_HTTPS']) && ($_SERVER['HTTP_X_HTTPS']) ) ? 'https':'http'; if(is_file('force-https')) { $_protocol='https'; } $ra57c1=substr( $_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'],'/index.php') ); list ($x57de2, ) = explode(':',$_SERVER['HTTP_HOST']); $full_blog_url=$_protocol. '://'. $x57de2.$ra57c1; $_user_folder_name=str_replace('/','--',$x57de2.$ra57c1); if(substr($_user_folder_name,0,4)=='www.'){ $_user_folder_name=substr($_user_folder_name,4); } if(is_file('multiuser')) { if ( !empty ($_superconfig) and array_key_exists('rewrites',$_superconfig) and array_key_exists($_user_folder_name,$_superconfig['rewrites']) ) { $_user_folder_name=$_superconfig['rewrites'][$_user_folder_name]; } define('USER_FOLDER','users/'. $_user_folder_name .'/'); } else { define('USER_FOLDER','user/'); } if( !empty ($_superconfig) and array_key_exists('store_files_by_users',$_superconfig) and $_superconfig['store_files_by_users'] ) { define('MEDIA_ROOT_FOLDER',USER_FOLDER .'files/'); } else { define('MEDIA_ROOT_FOLDER',''); } define('EXTRAS_FOLDER',USER_FOLDER.'extras/'); define('BACKUP_FOLDER',USER_FOLDER.'backup/'); define('CACHES_FOLDER',USER_FOLDER.'caches/'); define('USER_LIBRARY_FOLDER',USER_FOLDER.'library/'); define('LOG_FOLDER',USER_FOLDER.'logs/'); define('PICTURES_FOLDER','pictures/'); define('THUMBNAILS_FOLDER','pictures/thumbs/'); define('AVATARS_FOLDER','pictures/avatars/'); define('AUDIO_FOLDER','audio/'); define('TEMPLATES_FOLDER','themes/'); define('SYSTEM_FOLDER','system/'); define('SCRIPTS_FOLDER','system/js/'); define('SYSTEM_LIBRARY_FOLDER','system/library/'); define('SYSTEM_TEMPLATE_FOLDER','system/theme/'); define('AUDIO_ICON_IMAGE','system/theme/images/audio.svg'); define('AUDIO_ICON_WIDTH',80); define('AUDIO_ICON_HEIGHT',80); define('LANGUAGES_FOLDER','system/languages/'); define('DEFAULTS_FOLDER','system/default/'); define('MTMPL_FOLDER','system/default/mail/'); define('DEFAULT_TEMPLATE','plain'); if(!is_file(DEFAULTS_FOLDER. 'config.php')) die ('System config missing'); include DEFAULTS_FOLDER.'config.php'; $_default_config=$_config; if(is_file(USER_FOLDER. 'config.php')) { include USER_FOLDER.'config.php'; $_config=array_merge($_default_config,$_config); } define('E2E_STRANGE_ERROR',10); define('E2E_USER_ERROR',20); define('E2E_PERMISSIONS_ERROR',30); define('E2E_MESSAGE',100); define('E2E_DIAGNOSTICS_MESSAGE',110); define('DEFAULT_ITEMS_PER_PAGE',10); define('MAX_ITEMS_PER_PAGE',100); define('FP_NO_ID_OR_NEW', -1); define('FP_INSERT_ERROR', -10); define('FP_UPDATE_ERROR', -11); define('FP_EMPTY_FIELD', -20); define('FP_TITLE_OR_TEXT_EMPTY', -21); define('FP_NOT_COMMENTABLE', -30); define('FP_COMMENT_DOUBLE_POST', -101); define('FP_COMMENT_TOO_LONG', -102); define('FP_COMMENT_SPAM_SUSPECT', -103); define('NOTE_COMMENTABLE_NOW', -1); define('NOTE_COMMENTABLE_NOW_CONDITIONALLY', -2); define('ENTITY_TYPE_UNSPECIFIED',''); define('ENTITY_TYPE_NOTE','n'); define('ENTITY_TYPE_TAG','t'); define('THUMB_WIDTH',200); define('THUMB_HEIGHT',160); define('THUMB_JPG_QUALITY',90); define('SCALED_IMAGE_JPG_QUALITY',80); define('USERPIC_WIDTH',80); define('USERPIC_HEIGHT',80); define('USERPIC_JPG_QUALITY',95); define('RESOURCES_ALL',0); define('RESOURCES_LOCAL',1); $_fp_error=false; if(strstr(__FILE__,'all.php')) { define('BUILT',0); } else { define('BUILT',1); } function e2_go_to($o56790=''){ global$_protocol,$errors,$x57de2,$ra57c1; @session_start(); $_SESSION['errors']=$errors; if(substr($o56790,0,strlen($_protocol)+3)!=$_protocol .'://'){ header('Location: '. $_protocol .'://'. $x57de2.$ra57c1 .'/'. $o56790); } else { header('Location: '. $o56790); } flush(); return true; } function j4930(){ $k469bb=$_SERVER['HTTP_REFERER']; return e2_go_to($k469bb); } function s4924($o56790){ if($_SERVER['HTTP_REFERER'])$o56790=$_SERVER['HTTP_REFERER']; return e2_go_to($o56790); } function v8c3b($hb2145=''){ $i9dd4e=substr_count($_SERVER['HTTP_HOST'],'.'); $r2cb9d=@str_repeat('_',$i9dd4e).$hb2145; return $r2cb9d; } function ic64a($hb2145,$w2063c='',$fb0b70=true){ $zcd91e=$fb0b70? (time()+3600*24*365) : (0); $rad5f8=$_SERVER['HTTP_HOST']; $ye9c6c=substr_count($rad5f8,'.'); if ($ye9c6c < 3)$rad5f8=str_repeat('.',3-$ye9c6c).$rad5f8; $i9dd4e=setcookie(v8c3b($hb2145),$w2063c,$zcd91e,'/'); } function l163d($p183d6,$fb45cf,$ucadc8=''){ if(trim($fb45cf)!=''){ $fb45cf=explode($p183d6,$fb45cf); foreach ($fb45cf as $f865c0 => $d8ce4b)$fb45cf[$f865c0]=trim($d8ce4b); foreach ($fb45cf as $f865c0 => $d8ce4b) if ($d8ce4b=='') unset ($fb45cf[$f865c0]); $z7b774=array_unique($fb45cf); if ('sort'==$ucadc8)sort($z7b774); return $z7b774; } else return array (); } function l2183($fb45cf){ $te358e=array(); if(is_file(DEFAULTS_FOLDER.'romanize.txt')) { $te358e=file(DEFAULTS_FOLDER.'romanize.txt'); } $dd98a0=$j01b6e=''; foreach ($te358e as $f865c0 => $s6438c){ if (!($f865c0%2))$dd98a0.=rtrim($s6438c) .' '; else $j01b6e.=rtrim($s6438c) .' '; if ($f865c0%2){ while (mb_strlen($j01b6e) < mb_strlen($dd98a0))$j01b6e.=' '; while (mb_strlen($j01b6e) > mb_strlen($dd98a0))$dd98a0.=' '; } } $k60ae1=''; $wde2e7=-1; for ($f865c0=0; $f865c0 < mb_strlen($dd98a0); ++ $f865c0){ $c4a8a0=mb_substr($dd98a0,$f865c0,1); if ($c4a8a0!=' '){ $k60ae1.=$c4a8a0; if ($wde2e7 == -1)$wde2e7=$f865c0; } elseif ($k60ae1){ $w52ac1=trim(mb_substr($j01b6e,$wde2e7,mb_strpos($j01b6e,' ',$wde2e7+1)-$wde2e7)); $n33c9b=array ($k60ae1,$w52ac1); $fce83f[mb_strlen($k60ae1)][] = $n33c9b; $k60ae1=''; $wde2e7=-1; } } $y1d78d=array(); for ($f865c0=count($fce83f); $f865c0 > 0; -- $f865c0){ foreach ($fce83f[$f865c0] as $n33c9b)$y1d78d[$n33c9b[0]] = $n33c9b[1]; } return strtr($fb45cf,$y1d78d); } function te1e7($ocdaee,$action,$u4a202){ if (!is_array($ocdaee))$ocdaee=array(); if($action=='add'){ $ocdaee=array_unique(array_merge($ocdaee,$u4a202)); } if($action=='remove'){ unset ($ocdaee[array_search($u4a202,$ocdaee)]); } if (!is_array($ocdaee))$ocdaee=array(); return $ocdaee; } function r705b($s8d777){ $parameters=$s8d777['parameters']; $gd1fc8=[ 'success' => false ]; try { $s8d777['flipping-function'] ($parameters); $u67142=$parameters; $u67142['value'] = !$parameters['value']; $gd1fc8=[ 'success' => true, 'data' => [ 'flag-now-on' => ($parameters['value']==1), 'new-href' => x83c8($s8d777['candy-name'],$u67142), ] ]; } catch (AeMySQLException $e){ b12f6($e,'Could not set '. $s8d777['flag-name'] .' flag'); } if(array_key_exists('result',$_POST) and ($_POST['result']=='ajaxresult')) { $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } else { e2_go_to(x83c8('e2m_tag',$parameters)); die; } } function xbb8d($fb45cf){ $y5269f=@$_SERVER['HTTP_USER_AGENT'] or $y5269f=''; $x8f0c7=strstr($y5269f,'iPhone') || strstr($y5269f,'iPad'); $j8bf10=strstr($y5269f,'Macintosh'); if ($x8f0c7) return ''; if ($fb45cf=='submit'){ if ($j8bf10){ return '&#x2303; &#x21a9;'; } else { return 'Ctrl + Enter'; } } if ($fb45cf=='livesave'){ if ($j8bf10){ return '&#x2318; S'; } else { return 'Ctrl + S'; } } if ($fb45cf=='navigation'){ if ($j8bf10){ return '&#x2325;'; } else { return 'Ctrl'; } } if ($fb45cf=='navigation-later'){ if ($j8bf10){ return '&#x2325; &uarr;'; } else { return 'Ctrl + &uarr;'; } } if ($fb45cf=='navigation-earlier'){ if ($j8bf10){ return '&#x2325; &darr;'; } else { return 'Ctrl + &darr;'; } } } function f7b91($a1cb25){ $a1cb25=str_replace('<','&lt;',$a1cb25); $a1cb25=str_replace('>','&gt;',$a1cb25); return $a1cb25; } function pc4b6($a1cb25){ $a1cb25=str_replace('"','&quot;',$a1cb25); return $a1cb25; } function yd056($w2063c,$m5d6db){ return str_replace('.',',',round($w2063c,$m5d6db)); } function e2_stripslashes_array($cf1f71){ return is_array($cf1f71)?array_map('e2_stripslashes_array',$cf1f71):stripslashes($cf1f71); } function oabdd(){ if(version_compare(PHP_VERSION,'7.4') >= 0) return; if(get_magic_quotes_runtime()) { set_magic_quotes_runtime(0); } if(get_magic_quotes_gpc()) { $_GET=e2_stripslashes_array($_GET); $_POST=e2_stripslashes_array($_POST); $_COOKIE=e2_stripslashes_array($_COOKIE); $_REQUEST=e2_stripslashes_array($_REQUEST); } } function g0786($r957b5){ return sprintf('%u',ip2long($r957b5)); } function r7c85($ib1bc2){ return long2ip(sprintf('%d',$ib1bc2)); } function e2_decline_for_number($a1cb25,$ib1bc2=null){ $p2f713=$a1cb25; if ($ib1bc2===null){ $ib1bc2=substr($a1cb25,0,strpos($a1cb25,' ')); $p2f713=substr($a1cb25,strpos($a1cb25,' ')+1); } $mf07c9=strpos($p2f713,'('); $e46901=strpos($p2f713,')'); if ($e46901 > $mf07c9)$j22b9f=substr($p2f713,$mf07c9,$e46901-$mf07c9+1); $n93da6=explode(',',trim(@$j22b9f,'()')); if(count($n93da6)==2)array_unshift($n93da6,''); $cc78bd=array (2,0,1,1,1,2,2,2,2,2); if ($ib1bc2%100 > 10 and $ib1bc2%100 < 20)$dcd14c=2; else $dcd14c=$cc78bd[$ib1bc2%10]; $hef3e3=$n93da6[$dcd14c]; $a1cb25=str_replace($j22b9f,$hef3e3,$a1cb25); if(strstr($a1cb25,'(') and strstr($a1cb25,')')) { return e2_decline_for_number($a1cb25,$ib1bc2); } else { return $a1cb25; } } function jc5a6($if2ce1){ $k87e9e=glob($if2ce1,GLOB_NOSORT); if(is_array($k87e9e)) { foreach ($k87e9e as $j435ed){ @unlink($j435ed); } } } function a74dc($d73600){ $k87e9e=glob($d73600 .'*',GLOB_NOSORT); if(is_array($k87e9e)) { foreach ($k87e9e as $j435ed){ if(basename($j435ed)!='.' and basename($j435ed)!='..'){ if(is_dir($j435ed)) { if (a74dc($j435ed .'/')) { if (!rmdir($j435ed)) { return false; } } else { return false; } } else { @unlink($j435ed); } } } return true; } else { return false; } } function eaf42($dd6fe1){ $dd6fe1=trim($dd6fe1,'/'); $dd6fe1=explode('/',$dd6fe1); $d73600=''; foreach ($dd6fe1 as $v83878){ $d73600=$d73600.$v83878; if (!is_dir($d73600)) { if (@mkdir($d73600)) { @chmod($d73600,E2_NEW_FILES_RIGHTS); } else { return false; } } $d73600=$d73600.'/'; } return true; } function e4d36($dd6fe1){ return preg_replace('/\/([^\/]+?)\/\.\./','',$dd6fe1); } function yce9b($fb45cf){ $icee6f=get_html_translation_table(HTML_ENTITIES); $icee6f=array_flip($icee6f); return strtr($fb45cf,$icee6f); } function v7f78($u32c11=NULL){ if(NULL==$u32c11)$u32c11=microtime(); list ($q6021b,$l74459)=explode(' ',$u32c11); return ((float)$q6021b + (float)$l74459); } function r74e0(){ global$settings; if (!isset ($settings))$settings=array(); $cfa816=array(); if(is_file(USER_FOLDER.'settings.json')) { $cfa816=json_decode(file_get_contents(USER_FOLDER.'settings.json'),true); $q098f6=13; } elseif(is_file(USER_FOLDER.'settings.psa')) { $cfa816=unserialize(file_get_contents(USER_FOLDER.'settings.psa')); } if (!is_array($cfa816))$cfa816=array(); $settings=array_merge($settings,$cfa816); if ( !array_key_exists('appearance',$settings) or !array_key_exists('notes_per_page',$settings['appearance']) or !is_numeric($settings['appearance']['notes_per_page']) or $settings['appearance']['notes_per_page'] < 1 ){ $settings['appearance']['notes_per_page']=DEFAULT_ITEMS_PER_PAGE; } if($settings['appearance']['notes_per_page'] > MAX_ITEMS_PER_PAGE){ $settings['appearance']['notes_per_page']=MAX_ITEMS_PER_PAGE; } if ( !array_key_exists('comments',$settings) or !array_key_exists('default_on', @$settings['comments']) ) { $settings['comments']['default_on']=false; } return true; } function e2m_settings(){ global$settings,$_template,$_strings; $rf3e33=array(); $g5e107=DEFAULT_LANGUAGE; if(array_key_exists('language',$settings)) { $g5e107=$settings['language']; } foreach(glob(LANGUAGES_FOLDER. '*.php') as $j435ed){ $r5b54c=substr(basename($j435ed),0,2); $b98bf7=file_get_contents($j435ed); if(preg_match( '/^ *\/\/ *display_name *\= *(.*?) *$/ismu',$b98bf7,$j9c28d )) { $yc2657=$j9c28d[1]; } else { $yc2657=$r5b54c; } $rf3e33[$r5b54c] = array ( 'selected?' => (bool) ($g5e107==$r5b54c), 'display-name' => $yc2657, ); } $r2cb9d['title']=$_strings['pt--settings']; $r2cb9d['heading']=$_strings['pt--settings']; $r2cb9d['form']='form-preferences'; $r2cb9d['form-preferences'] = array ( 'blog-title-default' => htmlspecialchars($_strings['e2--default-blog-title'],ENT_COMPAT,HSC_ENC), 'blog-title' => htmlspecialchars(n6f51(),ENT_COMPAT,HSC_ENC), 'blog-description' => htmlspecialchars(@$settings['description'],ENT_COMPAT,HSC_ENC), 'blog-author-default' => htmlspecialchars($_strings['e2--default-blog-author'],ENT_COMPAT,HSC_ENC), 'blog-author' => htmlspecialchars(@$settings['author'],ENT_COMPAT,HSC_ENC), 'languages' => $rf3e33, 'language' => $g5e107, 'form-action' => x83c8('e2s_settings_save'), 'userpic-href' => f2461('square'), 'notes-per-page' => $settings['appearance']['notes_per_page'], 'email-notify?' => (bool) @$settings['notifications']['new_comments'], 'email' => htmlspecialchars(@$settings['user']['email'],ENT_NOQUOTES,HSC_ENC), 'comments-default-on?' => (bool) @$settings['comments']['default_on'], 'comments-require-gip?' => (bool) @$settings['comments']['require_gip'], 'comments-fresh-only?' => (bool) @$settings['comments']['fresh_only'], 'show-view-counts?' => (bool)$settings['appearance']['show_view_counts'], 'show-sharing-buttons?' => (bool)$settings['appearance']['show_sharing_buttons'], 'includes-google-analytics?' => false, 'includes-yandex-metrika?' => false, 'template-name' => $_template['name'], 'templates' => k94dd(), 'respond-to-dark-mode?' => (bool) @$settings['appearance']['respond_to_dark_mode'], 'submit-text' => $_strings['fb--save-changes'], 'space-usage' => zaf64(yd10e(),true), ); return $r2cb9d; } function e2s_settings_save(){ global$settings,$_strings; if($_SERVER['REQUEST_METHOD']!='POST') return e2_go_to(x83c8('e2m_settings')); $d05df2=$f67daf=''; if(array_key_exists('blog-title',$_POST)) { $d05df2=trim($_POST['blog-title']); } if(array_key_exists('blog-description',$_POST)) { $f67daf=trim($_POST['blog-description']); } if(array_key_exists('blog-author',$_POST)) { $j02bd9=trim($_POST['blog-author']); } if(array_key_exists('language',$_POST)) $k8512a=$_POST['language']; if(array_key_exists('email',$_POST)) $a0c83f=trim($_POST['email']); $y0c2bd=(int)$_POST['notes-per-page']; $settings['site_title']=$d05df2; $settings['site_title']=n6f51(); $settings['author']=$j02bd9; $settings['user']['email']=$a0c83f; $settings['notifications']['new_comments'] = isset ($_POST['email-notify']); if(array_key_exists('template',$_POST)) { $settings['template']=trim($_POST['template']); } $settings['comments']['default_on'] = isset ($_POST['comments-default-on']); $settings['comments']['require_gip'] = isset ($_POST['comments-require-gip']); $settings['appearance']['show_view_counts'] = isset ($_POST['show-view-counts']); if ( !array_key_exists('language',$settings) or $settings['language']!=$k8512a or $settings['description']!=$f67daf or $settings['appearance']['notes_per_page']!=$y0c2bd or $settings['appearance']['show_sharing_buttons'] != isset ($_POST['show-sharing-buttons']) or $settings['appearance']['respond_to_dark_mode'] != isset ($_POST['respond-to-dark-mode']) or $settings['comments']['fresh_only'] != isset ($_POST['comments-fresh-only']) ) { @unlink(CACHE_FILENAME_FRONTPAGE); @unlink(CACHE_FILENAME_FRONTPAGE_FEED); @unlink(CACHE_FILENAME_FRONTPAGE_AUTHOR); $settings['description']=$f67daf; $settings['language']=$k8512a; $settings['appearance']['notes_per_page']=$y0c2bd; $settings['appearance']['show_sharing_buttons'] = isset ($_POST['show-sharing-buttons']); $settings['appearance']['respond_to_dark_mode'] = isset ($_POST['respond-to-dark-mode']); $settings['comments']['fresh_only'] = isset ($_POST['comments-fresh-only']); } jc5a6(CACHE_FILENAMES_NOTES_COMMENTS); if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { q8a40($_strings['er--settings-not-saved'],E2E_PERMISSIONS_ERROR); e2_go_to(x83c8('e2m_settings')); die; } e2_go_to(x83c8('e2m_frontpage', array ('page' => 1))); die; } function e2m_database(){ global$settings,$_strings,$_superconfig; if (@$_superconfig['disallow_db_config']) { return e2_error404_mode(); } $r2cb9d['title']=$_strings['pt--database']; $r2cb9d['heading']=$_strings['pt--database']; $r2cb9d['form']='form-database'; $r2cb9d['form-database'] = array ( 'form-action' => x83c8('e2s_database_save'), 'db-server' => htmlspecialchars(@$settings['db']['server']? $settings['db']['server']:'localhost'), 'db-user' => htmlspecialchars(@$settings['db']['user_name']? $settings['db']['user_name']:'root'), 'db-password' => htmlspecialchars(iee85(@$settings['db']['passw'])), 'db-database' => htmlspecialchars(@$settings['db']['name']), 'submit-text' => $_strings['fb--connect-to-this-db'], ); return $r2cb9d; } function e2s_database_save(){ global$settings,$_db,$_superconfig,$_strings,$_config; if($_SERVER['REQUEST_METHOD']!='POST') return e2_go_to(x83c8('e2m_database')); if (@$_superconfig['disallow_db_config']) { return e2_error404_mode(); } $d78940['server'] = @$_POST['db-server']; $d78940['user_name'] = @$_POST['db-user']; $d78940['passw'] = n1305(@$_POST['db-password']); $d78940['name'] = @$_POST['db-database']; $pad3da=false; try { q985b('check database from HTTP post',$d78940); $aaae42=e2_model_data_check($d78940['name']); if (!$aaae42['occupied'] or !$aaae42['migrateable']) { q8a40($_strings['er--db-data-incomplete']); e2_go_to(x83c8('e2m_database')); die; } cbb8d(); $pad3da=true; } catch (AeMySQLCannotConnectException $e){ q8a40( $_strings['er--cannot-connect-to-db']. ':<br />'. mysqli_connect_error() .' ('. mysqli_connect_errno() .')' ); } catch (AeMySQLTooOldException $e){ q8a40(e2l_get_string('er--mysql-version-too-old', [ 'v1' => $_db['version'], 'v2' => E2_MINIMUM_MYSQL, ])); } catch (AeMySQLException $e){ q8a40($_strings['er--cannot-find-db'] .' '. $d78940['name']); } if (!$pad3da){ e2_go_to(x83c8('e2m_database')); die; } $settings['db']=$d78940; if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { q8a40($_strings['er--settings-not-saved'],E2E_PERMISSIONS_ERROR); e2_go_to(x83c8('e2m_database')); die; } e2_drop_all_kinds_of_cache(); if (!$_config['retain_search_indexes_on_db_switch']) { $fddece=a476c(); try { $fddece -> erase(); } catch (\S2\Rose\Exception\RuntimeException $e){ if(Log::$ned2b5)__log('Rose not available'); } c198f(); } gcc38(x83c8('e2s_bsi_step')); e2_go_to(x83c8('e2m_settings')); die; } function rda67(){ return class_exists('ZipArchive'); } function e2m_get_backup(){ if (rda67()) { $vfbade=new ZipArchive(); $r979eb=BACKUP_FOLDER .'backup.zip'; if ($vfbade -> open($r979eb,ZIPARCHIVE::CREATE)) { @ $vfbade -> addEmptyDir('backup'); @ $vfbade -> addEmptyDir('backup/db'); @ $vfbade -> addFile(USER_FOLDER.'[email protected]','backup/files/[email protected]'); @ $vfbade -> addFile(USER_FOLDER.'[email protected]','backup/files/[email protected]'); foreach(glob(BACKUP_FOLDER .'backup-*.sql') as $d8c7dd); $vfbade -> addFile($d8c7dd,'backup/db/'. basename($d8c7dd)); $vfbade -> close(); } if(is_file($r979eb)) { header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="backup.zip"'); readfile($r979eb); unlink($r979eb); } else { die ('Cannot get backup'); } die; } else { die ('Cannot get backup'); } } if(substr(@$_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2)=='ru'){ define('DEFAULT_LANGUAGE','ru'); } else { define('DEFAULT_LANGUAGE','en'); } function e2l_get_string($bfa206,$s8d777){ global$_strings; $vb0689=$_strings[$bfa206]; if(preg_match_all('/\$\[(.+?)\]/u',$vb0689,$j9c28d,PREG_SET_ORDER)) { foreach ($j9c28d as $pe3cc9){ $hb2145=$pe3cc9[1]; $af2ffc=''; if(strstr($hb2145,'.')) list ($hb2145,$af2ffc)=explode('.',$hb2145,2); if(array_key_exists($hb2145,$s8d777)) { if ($af2ffc){ $vb0689=str_replace($pe3cc9[0],e2l__format_value($af2ffc,$s8d777[$hb2145],$bfa206),$vb0689); } else { $vb0689=str_replace($pe3cc9[0],$s8d777[$hb2145],$vb0689); } } } } return $vb0689; } function e2l__format_value($af2ffc,$w2063c,$bfa206){ list ($af2ffc,$t3ad73)=explode('.',$af2ffc,2); $je6875='e2lstr_'. $af2ffc; if(function_exists($je6875)) { return call_user_func($je6875,$w2063c,$t3ad73,$bfa206); } else { return $w2063c; } return $w2063c; } function hfc91(){ global$_lang,$settings; if ( array_key_exists('language',$settings) and is_file($h2d354=LANGUAGES_FOLDER.$settings['language'] .'.php') ) { $_lang=$settings['language']; include $h2d354; } elseif(is_file($h2d354=LANGUAGES_FOLDER.DEFAULT_LANGUAGE .'.php')) { $_lang=DEFAULT_LANGUAGE; include $h2d354; } else { die ('Language file missing: '. $h2d354); } return e2l_load_strings(); } define('LOG_FILE',LOG_FOLDER.'main.log'); define('LOG_DEBUG_FILE',LOG_FOLDER.'debug.log'); class Log { public static $ned2b5=false; public static $e34a72=false; } function r372b(){ global$_config; if ( $_config['write_log'] and ($_config['write_log_create'] or is_file(LOG_FILE)) ) { Log::$ned2b5=true; Log::$e34a72=true; } else { Log::$ned2b5=false; Log::$e34a72=false; } if (!Log::$ned2b5) return; @eaf42(LOG_FOLDER); if($_config['write_log_reset']) { @file_put_contents(LOG_FILE,''); @chmod(LOG_FILE,E2_NEW_FILES_RIGHTS); } if (@$_config['write_log_limit'] and is_file(LOG_FILE)) { $jbc7b3=@stat(LOG_FILE); $jbc7b3=$jbc7b3['size']; if ($jbc7b3 > $_config['write_log_limit']) { @rename(LOG_FILE,LOG_FILE .'.bak'); @chmod(LOG_FILE .'.bak',E2_NEW_FILES_RIGHTS); @file_put_contents(LOG_FILE,''); } } __log(''); } function v714a($q22af6=false) { static $t197b1=false; if ($q22af6===false) return $t197b1; if ($q22af6==='') return $t197b1=false; $j435ed=str_replace( '$',gmdate('Y-m-d-\a\t-H-i-s'),$q22af6 ); return $t197b1= $j435ed; } function __log($a1cb25){ static $r12a05; global$_stopwatch; $td8367=v714a(); $y605ac=''; $paf240=str_pad(round(v7f78()-$_stopwatch,5),10,' ',STR_PAD_RIGHT); if ($a1cb25[0]=='}'){ -- $r12a05; if ($r12a05 < 0)$r12a05=0; } $t8e13f=( E2_RUN_ID .' '. $y605ac .''. $paf240 .' '. str_repeat(' ',$r12a05*2). $a1cb25."\n" ); if ($a1cb25[strlen($a1cb25)-1]=='{'){ ++ $r12a05; } $y15d61=FILE_APPEND; if(Log::$e34a72){ @file_put_contents(LOG_FILE,$t8e13f,$y15d61); @chmod(LOG_FILE,E2_NEW_FILES_RIGHTS); } if ($td8367!==false){ $j435ed=LOG_FOLDER.$td8367 .'.log'; @eaf42(LOG_FOLDER); @file_put_contents($j435ed,$t8e13f,$y15d61); @chmod($td8367,E2_NEW_FILES_RIGHTS); } if ($a1cb25[0]=='#'){ @eaf42(dirname(LOG_DEBUG_FILE). '/'); @file_put_contents(LOG_DEBUG_FILE,$t8e13f,$y15d61); @chmod(LOG_DEBUG_FILE,E2_NEW_FILES_RIGHTS); } } function sce80($r6bf76){ @k6e52( USER_FOLDER .'ctree.php', "<?php\r\n\r\n". var_export($r6bf76,true). "\r\n\r\n?>php" ); } function e2s_log(){ @eaf42(LOG_FOLDER); @file_put_contents(LOG_FILE,''); @chmod(LOG_FILE,E2_NEW_FILES_RIGHTS); die ('Log file created.'); } function q8a40($f67daf,$type=E2E_STRANGE_ERROR){ global$errors,$settings, $_config, $_strings, $_diagnose; if (!isset ($errors))$errors=[]; $o1897a=(!we852()+1 <= (int)$_config['show_call_stack']); if ($f67daf){ if ($f67daf[0]!='<')$f67daf='<p>'.$f67daf .'</p>'; $fcd1dd=array ( 'description' => $f67daf, 'type' => $type, ); if($type==E2E_STRANGE_ERROR and $o1897a){ $fcd1dd['backtrace']=debug_backtrace(); } $errors[] = $fcd1dd; } if($type==E2E_PERMISSIONS_ERROR){ $_diagnose['need?']=true; ic64a('diagnose','1'); } return true; } function k8739(){ global$errors,$e1c0b7,$_strings,$_diagnose; $j7287a=jea70(); if(count($j7287a)==0){ ic64a('diagnose',''); unset($_COOKIE['diagnose']); $_diagnose['need?']=false; $_diagnose['ok?']=true; return true; } else { $i6e2ba=''; $i6e2ba.='<p>'. $_strings['gs--enable-write-permissions-for-the-following'] .'</p>'; $i6e2ba.='<ul>'; foreach ($j7287a as $x8fa14){ if ($x8fa14=='.')$x8fa14=''; $i6e2ba.='<li><tt>./'. $x8fa14 .'</tt></li>'; if(Log::$ned2b5)__log('Diagnostics: cannot write <'. $x8fa14 .'>'); } $i6e2ba.='</ul>'; $fcd1dd=array ( 'title' => $_strings['et--fix-permissions-on-server'], 'description' => $i6e2ba, 'type' => E2E_DIAGNOSTICS_MESSAGE, 'class' => 'serious', ); $errors[] = $fcd1dd; $_diagnose['ok?']=false; return false; } } function we1c4($qc1336,$f67daf,$l1407f,$qc2d4b,$x4f62c){ global$errors; if(0==error_reporting() or ($qc1336 & 8)) return; $l1407f=str_replace(__DIR__,'',$l1407f); q8a40($l1407f .', line '. $qc2d4b .'<br />Error '. $qc1336 .': '. $f67daf); $errors[count($errors)-1]['phpcode']=$qc1336; } function s2982($hf6cdd,$m78e73,$d8c7dd,$s6438c){ if (!(error_reporting() & $hf6cdd)) return; throw new ErrorException($m78e73,0,$hf6cdd,$d8c7dd,$s6438c); } function u0955(){ global$errors,$settings,$_config; if (!isset ($errors))$errors=[]; @session_start(); if(is_array(@$_SESSION['errors'])) { $e=array_merge(@$_SESSION['errors'],$errors); } else { $e=$errors; } $o1897a=(!we852()+1 <= (int)$_config['show_call_stack']); if (@$_config['store_backtrace'] and $o1897a and $e!=NULL){ @k6e52('backtrace.psa',serialize($e)); } else { @unlink('backtrace.psa'); } if (isset ($_SESSION['errors'])) unset($_SESSION['errors']); $r2cb9d=array(); $jb8735=false; if(count($e) > 0){ foreach($e as $f865c0 => $o08a44){ if ($o08a44['type']==E2E_STRANGE_ERROR){ $o08a44['class']='serious'; $jb8735=true; if ($o1897a){ $o08a44['backtrace']=i2616($o08a44['backtrace']); } } if ($o08a44['type']==E2E_MESSAGE){ $o08a44['class']='info'; } $e[$f865c0]=$o08a44; } $r2cb9d['each']=$e; if ( $jb8735 and @$_config['store_backtrace'] and $o1897a and is_file('debug.php') ) { $r2cb9d['debug-link']='debug.php'; } } return $r2cb9d; } function k4006(){ $errors=u0955(); foreach($errors['each'] as $rcb5e1){ echo '<p>'. $rcb5e1['description'] .'</p>'; } die; } function i2616($l69206){ global $ra57c1; if (!is_array($l69206)) return 'No backtrace info'; $l69206=array_reverse($l69206); $l69206=array_splice($l69206,0,count($l69206)-1); $e='<p style="background: #fea; padding: .25em .5em; line-height: 1em; overflow: hidden">'; foreach ($l69206 as $f865c0 => $te358e){ $l195df=@$te358e['args'] or $l195df=array(); $pa956a=array(); foreach ($l195df as $s5919c){ $pa956a[] = var_export($s5919c,true); } $d8c7dd=@$te358e['file']; $d8c7dd=str_replace($_SERVER['DOCUMENT_ROOT'],'',$d8c7dd); $s6438c=(@$te358e['line']? (' #'. $te358e['line']) : '?'); $e.='<div style="margin: .25em 0 .5em '. $f865c0*3 .'em">'; $e.='<span style="float: right; color: #666"> '. $d8c7dd.$s6438c .'</span>'; $e.='<tt><b>'. @$te358e['function'] .' (</b>'; if(count($pa956a)) { $zeb84a=str_replace("array (\n)",'array ()',$pa956a); $zeb84a=implode(', ',$zeb84a); if(0){ $zeb84a=highlight_string('<?'. $zeb84a .'?'.'>',true); $zeb84a=substr($zeb84a,77, -28); } $zeb84a=str_replace('&nbsp;',' ',$zeb84a); $zeb84a=nl2br($zeb84a); $e.='<div style="margin: 0 0 0 1.12em">'. $zeb84a .'</div>'; } $e.='<b>)</b> &rarr;</tt></div>'; } $e.='</p>'; return$e; } class AeException extends \Exception {} class AeMySQLException extends AeException {} class AeMySQLNotFoundException extends AeMySQLException {} class AeMySQLTooOldException extends AeMySQLException {} class AeMySQLCannotConnectException extends AeMySQLException {} class AeMySQLAccessDeniedException extends AeMySQLCannotConnectException {} class AeMySQLQueryException extends AeMySQLException {} class AeMySQLCorruptedUpdateRecordCallException extends AeMySQLException {} class AeInstallException extends AeException {} class AeInstallAlreadyInstalledException extends AeInstallException {} class AeInstallDatabaseOccupiedException extends AeInstallException {} class AeNotSavedException extends AeException {} class AePasswordHashNotSavedException extends AeNotSavedException {} class AeSettingsNotSavedException extends AeNotSavedException {} class AeModelUnknownTableException extends AeException {} class AeOlbaException extends AeException {} class AeOlbaTemplateMissingException extends AeOlbaException {} class AeNotAndCannotBeInstalledException extends AeException {} function od0c8($p42552,$y44fb5=false){ $y5ee24=substr(__DIR__,0,strrpos(__DIR__,'/')); $x70261=''; $b04a75=[]; foreach(array_reverse($p42552 -> getTrace()) as $r447b7){ $xb25b3['where']=str_replace( $y5ee24 .'/','',$r447b7['file'] ) .':'. $r447b7['line']; $g97346=[]; foreach ($r447b7['args'] as $b61dd8){ $g97346[] = htmlspecialchars( str_replace("\n","\n  ",var_export($b61dd8,true)), ENT_NOQUOTES,HSC_ENC ); } $h5eaa0=''; if(count($g97346)) { $h5eaa0=("\n". '  '. implode(",\n  ",$g97346). "\n" ); } $xb25b3['call']=$r447b7['function'] .' ('. $h5eaa0 .')'; $b04a75[] = $xb25b3; } if ((string)$p42552 -> getMessage()!==''){ $x70261.=$p42552 -> getMessage() ."\n"; } $x70261.="\n";; $x70261 .= ( get_class($p42552) .' in '. str_replace( $y5ee24 .'/','',$p42552 -> getFile() ) .':'. $p42552 -> getLine(). "\n" ); if ($p42552 -> getCode()) { $x70261.='Code: '. $p42552 -> getCode() ."\n"; } $g98594=''; $f865c0=1; foreach ($b04a75 as $s6438c){ $g98594.=$f865c0++ .'. '. $s6438c['where'] .' '. $s6438c['call']. "\n"; if (!$y44fb5)$g98594.="\n";; } $x70261.="\n";; if ($y44fb5){ $g98594=preg_replace('/^.*?$/smu','            $0',$g98594); $x70261.=''. "\n"; $x70261.=$g98594; $x70261.=''; } else { $x70261.=$g98594; } return $x70261; } function b12f6($p42552,$m78e73=''){ global$_config; if(__DEV)q8a40('<pre>'. od0c8($p42552) .'</pre>'); if($_config['log_errors']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('error-$'); } if(Log::$ned2b5)__log('Exception caught: '. od0c8($p42552,true)); if(Log::$ned2b5)v714a(''); if ((string)$m78e73!==''){ if(Log::$ned2b5)__log($m78e73); } } function q4aff($p42552){ global$_config,$content,$ra57c1; $content['title']=':-('; if(__DEV)$content['exception-string']=od0c8($p42552); if($_config['log_errors']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('error-$'); } if(Log::$ned2b5)__log('Panic: '. od0c8($p42552,true)); $r2cb9d=q166b('panic',true); if(Log::$ned2b5)__log(':-('); echo $r2cb9d; die; } function maefe($p42552){ q4aff($p42552); } $_url_map=array ( '@build' => 'e2://e2s_build', '@sync' => 'e2://e2s_sync', '@log' => 'e2://e2s_log', '@dump' => 'e2://e2s_dump', '@bsi' => 'e2://e2s_bsi_status', '@bsi/drop' => 'e2://e2s_bsi_drop', '@bsi/step' => 'e2://e2s_bsi_step', '@migrate' => 'e2://e2s_migrate', '@retrieve:url' => 'e2://e2s_retrieve', '@instantiate:version' => 'e2://e2s_instantiate', '@notify' => 'e2://e2s_notify', '@info' => 'e2://e2m_info', '@ajax/::' => 'e2://e2j_::', '@actions/::' => 'e2://e2s_::', '' => 'e2://e2m_frontpage?page=1', ':page' => 'e2://e2m_frontpage', 'rss' => 'e2://e2m_rss', 'json' => 'e2://e2m_json', 'sitemap.xml' => 'e2://e2m_sitemap_xml', ':year' => 'e2://e2m_year', ':year/:month' => 'e2://e2m_month', ':year/:month/:day' => 'e2://e2m_day', 'all' => 'e2://e2m_everything', ':note' => 'e2://e2m_note', ':note/edit' => 'e2://e2m_note_edit?is_published=1', ':note/favourite' => 'e2://e2m_note_flag_favourite?is_published=1&value=1', ':note/unfavourite' => 'e2://e2m_note_flag_favourite?is_published=1&value=0', ':note/show' => 'e2://e2m_note_flag?is_published=1&flag=IsVisible&value=1', ':note/hide' => 'e2://e2m_note_flag?is_published=1&flag=IsVisible&value=0', ':note/discuss' => 'e2://e2m_note_flag?is_published=1&flag=IsCommentable&value=1', ':note/quiet' => 'e2://e2m_note_flag?is_published=1&flag=IsCommentable&value=0', ':note/withdraw' => 'e2://e2m_note_withdraw?is_published=1', ':note/json' => 'e2://e2m_note_json', ':note/broadcast' => 'e2://e2m_note_broadcast', ':note/read' => 'e2://e2m_note_read', ':note/delete' => 'e2://e2m_note_delete?is_published=1', ':note/format/:formatter' => 'e2://e2m_note_use_formatter?is_published=1', ':note/:unsubscr' => 'e2://e2m_unsubscribe?is_published=1', ':note/:comnum' => 'e2://e2m_comment', ':note/:comnum/edit' => 'e2://e2m_comment_edit', ':note/:comnum/important' => 'e2://e2m_comment_flag_ajax?flag=IsFavourite&value=1', ':note/:comnum/usual' => 'e2://e2m_comment_flag_ajax?flag=IsFavourite&value=0', ':note/:comnum/replace' => 'e2://e2m_comment_flag_ajax?flag=IsVisible&value=1', ':note/:comnum/remove' => 'e2://e2m_comment_flag_ajax?flag=IsVisible&value=0', ':note/:comnum/spam' => 'e2://e2m_comment_flag?flag=IsSpamSuspect&value=1', ':note/:comnum/good' => 'e2://e2m_comment_flag?flag=IsSpamSuspect&value=0', ':note/:comnum/wipe' => 'e2://e2m_comment_delete', ':note/:comnum/reply/edit' => 'e2://e2m_comment_reply', ':note/:comnum/reply/important' => 'e2://e2m_comment_flag_ajax?flag=IsReplyFavourite&value=1', ':note/:comnum/reply/usual' => 'e2://e2m_comment_flag_ajax?flag=IsReplyFavourite&value=0', ':note/:comnum/reply/replace' => 'e2://e2m_comment_flag_ajax?flag=IsReplyVisible&value=1', ':note/:comnum/reply/remove' => 'e2://e2m_comment_flag_ajax?flag=IsReplyVisible&value=0', ':note/:comnum/reply/delete' => 'e2://e2m_comment_reply_delete', 'drafts' => 'e2://e2m_drafts', 'drafts/:draft' => 'e2://e2m_draft', 'drafts/:draft/edit' => 'e2://e2m_note_edit?is_published=0', 'drafts/:draft/show' => 'e2://e2m_note_flag?is_published=0&flag=IsVisible&value=1', 'drafts/:draft/hide' => 'e2://e2m_note_flag?is_published=0&flag=IsVisible&value=0', 'drafts/:draft/delete' => 'e2://e2m_note_delete?is_published=0', 'drafts/:draft/format/:formatter' => 'e2://e2m_note_use_formatter?is_published=0', 'drafts/:draft/:preview' => 'e2://e2m_draft_preview', 'sources' => 'e2://e2m_sources', 'sources/:source/trust' => 'e2://e2m_source_trust', 'sources/:source/premoderate' => 'e2://e2m_source_premoderate', 'sources/:source/ban' => 'e2://e2m_source_ban', 'sources/:source/forget' => 'e2://e2m_source_forget', 'tags' => 'e2://e2m_tags', 'tags/:tag' => 'e2://e2m_tag?page=1', 'tags/:tag/:page' => 'e2://e2m_tag', 'tags/:tag/rss' => 'e2://e2m_tag_rss', 'tags/:tag/json' => 'e2://e2m_tag_json', 'tags/:tag/edit' => 'e2://e2m_tag_edit', 'tags/:tag/delete' => 'e2://e2m_tag_delete', 'tags/:tag/pin' => 'e2://e2m_tag_flag_ajax?flag=IsFavourite&value=1', 'tags/:tag/unpin' => 'e2://e2m_tag_flag_ajax?flag=IsFavourite&value=0', 'untagged' => 'e2://e2m_untagged', 'hot' => 'e2://e2m_most_commented', 'selected' => 'e2://e2m_favourites?page=1', 'selected/:page' => 'e2://e2m_favourites', 'found' => 'e2://e2m_found&query=', 'found/:query' => 'e2://e2m_found', 'new' => 'e2://e2m_write', 'install' => 'e2://e2m_install', 'settings' => 'e2://e2m_settings', 'settings/name' => 'e2://e2m_name_and_author', 'settings/database' => 'e2://e2m_database', 'settings/password' => 'e2://e2m_password?recovery-key=', 'settings/password-reset' => 'e2://e2m_password_reset', 'settings/password/:reset' => 'e2://e2m_password', 'settings/timezone' => 'e2://e2m_timezone', 'settings/sessions' => 'e2://e2m_sessions', 'settings/theme-preview' => 'e2://e2m_theme_preview?theme=', 'settings/theme-preview/:theme' => 'e2://e2m_theme_preview', 'settings/get-backup' => 'e2://e2m_get_backup', 'sign-in' => 'e2://e2m_sign_in', 'sign-out' => 'e2://e2m_sign_out', 'sign-in/:provider' => 'e2://e2m_gip_sign_in', 'sign-out/:provider' => 'e2://e2m_gip_sign_out', 'sign-in-done/:provider' => 'e2://e2m_gip_sign_in_callback', ); $_url_chunks=array ( '\:page' => 'page\-(?P<page>\d+)', '\:year' => '(?P<year>\d{4})', '\:month' => '(?P<month>\d{1,2})', '\:day' => '(?P<day>\d{1,2})', '\:note' => array ( 'all\/(?P<alias>[-a-zA-Z0-9]+)', '(?P<year>\d{4})\/(?P<month>\d{1,2})\/(?P<day>\d{1,2})\/(?P<day_number>\d+)', ), '\:draft' => array ( '(?P<oalias2>[-a-zA-Z0-9]+)\/(?P<draft2>\d+)', '(?P<oalias>[-a-zA-Z0-9]+)', '-\/(?P<draft>\d+)', ), '\:comnum' => 'comment\-(?P<comment_number>[0-9]+)', '\:file' => '(?P<file>.*?)', '\:tag' => '(?P<tag_alias>[-a-zA-Z0-9,]+)', '\:query' => '(?P<query>.*?)', '\:provider' => '(?P<provider>.*?)', '\:version' => '\:(?P<version>\d+)', '\:source' => '\:(?P<source>.*?)', '\:picture' => '\:(?P<picture>.*?)', '\:unsubscr' => 'unsubscribe\:(?P<unsubscribe_email>.+?)\:(?P<unsubscribe_key>[0-9a-f]{32})', '\:reset' => 'reset\:(?P<recovery_key>[0-9a-f]{40})', '\:formatter' => '(?P<formatter>.*?)', '\:alias' => '(?P<newalias>[-a-zA-Z0-9]+)', '\:preview' => 'preview\:(?P<preview_key>[0-9a-f]{32})', '\:theme' => '(?P<theme>[-a-zA-Z0-9]+)', '\:source' => '(?P<source>\d+)', '\:url' => '\:(?P<url>[a-zA-Z0-9]+\=)', ); $_url_autoredirects=array ( '/^favo(?:u?)rites(\~.+)?$/i' => 'selected\\1', '/^favo(?:u?)rites\/(.+)/i' => 'selected/\\1', '/^keywords$/i' => 'tags', '/^keywords\/(.*)/i' => 'tags/\\1', '/^everything$/i' => 'all', '/^search\/(.+)/i' => 'found/\\1', '/^(\d{4}\/\d{1,2}\/\d{1,2}\/\d+)\/comments(\/?)$/i' => '\\1', '/^\~(\d+)/i' => 'page-\\1', '/\/?\~(\d+)/i' => '/page-\\1', ); function zb6b0($t572d4){ global$_url_autoredirects,$ra57c1; $t572d4=preg_replace(array_keys($_url_autoredirects),array_values($_url_autoredirects),$t572d4); if(preg_match('/^([0-9]+)[.-]([0-9]+)[.-]([0-9]+)(.*)/',$t572d4,$j9c28d)) { if(2==strlen($j9c28d[3]))$j9c28d[3]='20'.$j9c28d[3]; return ($j9c28d[3].'/'.$j9c28d[2].'/'.$j9c28d[1].$j9c28d[4]); } if(preg_match('/^tags\-rss\/(.*?)\/?$/',$t572d4,$j9c28d)) { $le4d23=substr($j9c28d[1],strrpos($j9c28d[1],'/')+1); return ('tags/'. $le4d23.'/rss/'); } return $t572d4; } function j7059(){ static $s6b2de=false; global$__synthetic_urls,$_config,$_superconfig; if ($s6b2de) return; $id0e31=$_config['url_composition']; if (!empty ($_superconfig) and array_key_exists('url_composition',$_superconfig)) { $id0e31=$_superconfig['url_composition']; } $__synthetic_urls=false; if ($id0e31=='synthetic'){ $__synthetic_urls=true; } if ($id0e31=='auto'){ if(function_exists('apache_get_modules')) { if(in_array('mod_rewrite',apache_get_modules())) { $__synthetic_urls=true; } } } $s6b2de=true; } function x83c8($uc48ba,$parameters=array ()) { global$_url_map,$_url_chunks,$_config,$__synthetic_urls,$_protocol,$x57de2,$ra57c1; $xc2bd7=array_flip($_url_map); if ( @$_config['preferred_domain_name'] and $_SERVER['HTTP_HOST']!=$_config['preferred_domain_name'] ) { $x57de2=$_config['preferred_domain_name']; } $t572d4=$_protocol .'://'. $x57de2.$ra57c1 .'/'; $h9c464='e2://'. $uc48ba; if(array_key_exists('page',$parameters)) { $e71860=$parameters['page']; } else { $e71860=1; } if($parameters){ $h9c464.='?'; $z1c61f=array(); $v21711=array(); foreach($parameters as $b3c6e0 => $w2063c){ if ($b3c6e0=='*note'){ $v21711[] = $b3c6e0; $z1c61f[] = e2urls__expand_tricky_parameters_for_note_($w2063c); } if ($b3c6e0=='*tags'){ $v21711[] = $b3c6e0; $z1c61f[] = e2urls__expand_tricky_parameters_for_tags_($w2063c); } if ($b3c6e0=='*tag'){ $v21711[] = $b3c6e0; $z1c61f[] = e2urls__expand_tricky_parameters_for_tags_(array ($w2063c)); } } foreach ($v21711 as $b3c6e0) unset($parameters[$b3c6e0]); foreach ($z1c61f as $p58e2a){ $parameters=array_merge($parameters,$p58e2a); } foreach($parameters as $b3c6e0 => $w2063c){ if (@$b3c6e0[0]!='_'){ $h9c464.=$b3c6e0 .'='. urlencode($w2063c) .'&'; } } $h9c464=substr($h9c464,0, -1); } if ($uc48ba=='e2m_draft' and $parameters['is-published']===1)$uc48ba='e2m_note'; if ($uc48ba=='e2m_note' and $parameters['is-published']===0)$uc48ba='e2m_draft'; if(array_key_exists($h9c464,$xc2bd7)) { if ($xc2bd7[$h9c464]!=='')$t572d4.=$xc2bd7[$h9c464] .'/'; return $t572d4; } else { $w44907=false; foreach ($xc2bd7 as $e45ea8 => $n9ea44){ $yb7365=$e45ea8; $yb7365=preg_quote($yb7365,'/'); $oed015=parse_url($e45ea8); $y2f532=$oed015['host']; $kebe09=parse_url($h9c464); if(strstr($e45ea8,'::')) { $offd6b=$kebe09['scheme'] .'://'. $kebe09['host']; $yb7365=str_replace('\:\:','(.*)',$yb7365); $yb7365='/^'. $yb7365 .'$/s'; if(preg_match($yb7365,$offd6b,$j9c28d)) { $dd6fe1=str_replace('::',$j9c28d[1],$n9ea44); $dd6fe1=str_replace('_','-',$dd6fe1); $b1b1cc=$kebe09['query']; if($__synthetic_urls and $b1b1cc){ $t572d4.=$dd6fe1 .'/?'. $b1b1cc; } elseif($__synthetic_urls){ $t572d4.=$dd6fe1 .'/'; } elseif ($b1b1cc){ $t572d4.='?go='. $dd6fe1 .'/?'. $b1b1cc; } else { $t572d4.='?go='. $dd6fe1 .'/'; } return $t572d4; } } $m54435=false; if ($uc48ba===$y2f532){ $w44907=true; if ($oed015['query']) { $j22c38=explode('&',$oed015['query']); foreach ($j22c38 as $m8822b){ list ($b3c6e0,$w2063c)=explode('=',$m8822b); $w2063c=urldecode($w2063c); $b3c6e0=str_replace('_','-',$b3c6e0); if ( array_key_exists($b3c6e0,$parameters) and $parameters[$b3c6e0]!=$w2063c ){ $m54435=true; break; } } } if (!$m54435){ if(preg_match_all('/\:[\-a-z]+/i',$n9ea44,$j9c28d)) { foreach ($j9c28d[0] as $tfc413){ $ob0f75=$_url_chunks['\\'. $tfc413]; if (!is_array($ob0f75)) { $ob0f75=array ($ob0f75); } $n05f62=$ob0f75[0]; foreach ($ob0f75 as $n05f62){ $weab03='/\(\?P\<(.*?)\>.*?\)/'; $p4274e=true; if (@preg_match_all($weab03,$n05f62,$j9c28d)) { $j9c28d=$j9c28d[1]; $p4274e=true; for ($f865c0=0; $f865c0 < count($j9c28d); ++ $f865c0){ if ( !array_key_exists(str_replace("_","-",$j9c28d[$f865c0]), $parameters) or $parameters[str_replace("_","-",$j9c28d[$f865c0])] === '' ){ $p4274e=false; break; } } } if (!$p4274e) continue; $sf9e1e=@preg_replace_callback( $weab03, function ($j9c28d) use ($parameters){ return$parameters[str_replace("_","-",$j9c28d[1])]; }, $n05f62 ); $sf9e1e=stripslashes($sf9e1e); $nc5d91=str_replace($tfc413,$sf9e1e,$n9ea44); break; } $n9ea44=$nc5d91; } } $x15214=array(); if ($n9ea44){ if($__synthetic_urls){ $t572d4.=$n9ea44 .'/'; } else { $x15214[] = 'go='. $n9ea44 .'/'; } } foreach($_GET as $d8ce4b => $t9e366) if(in_array($d8ce4b, array ('result','themeless'))) { $x15214[] = $d8ce4b . ($t9e366? ('='. urlencode($t9e366)) : ''); } if(count($x15214)) { $t572d4.='?'. implode('&',$x15214); } return $t572d4; } } } if ($w44907){ return $t572d4; } else { die ('Cannot compose url for candy '. $uc48ba); } } } function sb7e9($t572d4=null){ global$_url_map,$_url_chunks,$_config,$_current_url,$__synthetic_urls,$_protocol,$x57de2,$ra57c1; if ($t572d4===null) $t572d4=urldecode($_GET['go']); if(Log::$ned2b5)__log('Resolve "'. $t572d4 .'"'); j7059(); $q196c2=$t572d4; $t572d4=trim($t572d4,'/'); $t572d4=zb6b0($t572d4); $parameters=array(); foreach($_url_map as $p12a24 => $e45ea8){ $od532d=$p12a24; $od532d=preg_quote($od532d,'/'); if(strstr($p12a24,'::')) { $od532d=str_replace('\:\:','(.*)',$od532d); $od532d='/^'. $od532d .'$/s'; if(preg_match($od532d,$t572d4,$j9c28d)) { $b53b9e=str_replace('-','_',$j9c28d[1]); $h9c464=str_replace('::',$b53b9e,$e45ea8); } } elseif(strstr($p12a24,':')) { $y1e380=array(); foreach($_url_chunks as $d8ce4b => $t9e366){ if(is_array($t9e366)) { $y1e380[$d8ce4b]='(?:(?:'. implode(')|(?:',$t9e366) .'))'; } else { $y1e380[$d8ce4b]=$t9e366; } } $od532d=str_replace( array_keys($y1e380), array_values($y1e380), $od532d ); $od532d='/^'. $od532d .'$/s'; if(preg_match($od532d,$t572d4,$j9c28d)) { $h9c464=$e45ea8; foreach ($j9c28d as $b3c6e0 => $w2063c) if (!is_numeric($b3c6e0)) { $b3c6e0=str_replace('_','-',$b3c6e0); $parameters[$b3c6e0]=$w2063c; } } } else { if ($p12a24==$t572d4){ $h9c464=$e45ea8; break; } } } $yfafdd=(bool)$h9c464; if (!$h9c464)$h9c464='e2://e2_error404_mode'; $kebe09=parse_url($h9c464); $uc48ba=$kebe09['host']; if ($kebe09['query']) { $j22c38=explode('&',$kebe09['query']); foreach ($j22c38 as $m8822b){ list ($b3c6e0,$w2063c)=explode('=',$m8822b); $w2063c=urldecode($w2063c); $b3c6e0=str_replace('_','-',$b3c6e0); $parameters[$b3c6e0]=$w2063c; } } $r2cb9d=false; $parameters=e2urls__consolidate_tricky_parameters_($parameters); if ($yfafdd){ if($_config['force_canonical_urls']) { foreach (['draft2','oalias2'] as $cf4975){ if(array_key_exists($cf4975,$parameters)) { unset($parameters[$cf4975]); } } $k95d32=x83c8($uc48ba,$parameters); list ($pa4c3a,$wab96c)=explode('?',$_SERVER['REQUEST_URI'],2); $wa37bf=$_protocol .'://'.$_SERVER['HTTP_HOST'].$pa4c3a; $h5d6ba=$_protocol .'://'.$_SERVER['HTTP_HOST'].urldecode($pa4c3a); $wab96c=explode('&',$wab96c); foreach ($wab96c as $m6c0d0){ list ($j5c5e7, ) = explode('=',$m6c0d0); if ($j5c5e7=='go'){ $wa37bf.='?'. $m6c0d0; $h5d6ba.='?'. urldecode($m6c0d0); } } $_current_url=$wa37bf; if ($wa37bf!=$k95d32 and $h5d6ba!=$k95d32){ e2_go_to($k95d32); } } if(is_callable($uc48ba)) { $r2cb9d=array ($uc48ba,$parameters); } else { $r2cb9d=array (null, array ()); } } else { $r2cb9d=array (null, array ()); } foreach($_GET as $b3c6e0 => $w2063c){ if ($b3c6e0!=='go')$r2cb9d[1][$b3c6e0]=$w2063c; } if(Log::$ned2b5){ if(count($r2cb9d[1]) > 0){ $xf8cea=print_r($r2cb9d[1],true); $xf8cea=substr($xf8cea,8, -2); $xf8cea='    '. trim($xf8cea); $xf8cea=preg_replace('/^.*?$/smu','         $0',$xf8cea); $xf8cea=' with parameters:'."\r\n". $xf8cea; } __log( 'Resolved to candy "'. $r2cb9d[0] .'"'. $xf8cea ); } return $r2cb9d; } function e2urls__expand_tricky_parameters_for_note_($w39a37){ global $ra57c1,$_config,$_e2_day_numbers_by_note_id; if (!isset ($w39a37['IsPublished'])) { return array (); } if (!$w39a37['IsPublished']) { if ($w39a37['OriginalAlias']===''){ $parameters['draft']=$w39a37['ID']; } elseif(e2_draft_alias_use_count($w39a37['OriginalAlias']) == 1){ $parameters['oalias']=$w39a37['OriginalAlias']; } else { $parameters['draft2']=$w39a37['ID']; $parameters['oalias2']=$w39a37['OriginalAlias']; } $parameters['is-published']=0; return$parameters; } $parameters['is-published']=1; $xb80bb=$w39a37['ID']; $k96b8c=$w39a37['Stamp']; $mb2c6c=l0923($w39a37); if (!isset ($w39a37['__noalias!'])) { if (isset ($w39a37['alias'])) { $parameters['alias']=$w39a37['alias']; } else { $parameters['alias']=e2_active_alias_for_page_(ENTITY_TYPE_NOTE,$w39a37['ID']); if($parameters['alias']=='') unset($parameters['alias']); } } if(array_key_exists('alias',$parameters)) return$parameters; list ($q41529,$t6f8f5,$r8277e)=explode('/', h5a2f('Y/m/d',$k96b8c,$mb2c6c) ); $parameters['year']=$q41529; $parameters['month']=$t6f8f5; $parameters['day']=$r8277e; if (isset ($w39a37['day_number'])) { $parameters['day-number']=$w39a37['day_number']; } elseif (isset ($_e2_day_numbers_by_note_id[$w39a37['ID']])) { $parameters['day-number']=$_e2_day_numbers_by_note_id[$w39a37['ID']]; } else { list ($yd9d0f, ) = z5273($q41529,$t6f8f5,$r8277e); u0738( "SELECT `ID`, `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished` = 1 AND (`Stamp` BETWEEN " .$yd9d0f. " AND " .$k96b8c. ") ". "ORDER BY `Stamp`", 'get all notes that could be on this date even in different timezones for legacy url resolution' ); $result=d0d6b(); $ib1bc2=1; foreach($result as $m65afd){ if ( $q41529.'/'.$t6f8f5.'/'.$r8277e == h5a2f('Y/m/d',$m65afd['Stamp'],l0923($m65afd)) ) { if ($m65afd['ID']==$xb80bb){ $g444bc=1; break; } $ib1bc2 ++; } } if (@$g444bc!=1){ header('HTTP/1.1 503 Service Unavailable'); die ('Candidates enumeration failed.'); } $parameters['day-number']=$ib1bc2; $_e2_day_numbers_by_note_id[$w39a37['ID']] = $ib1bc2; } return$parameters; } function e2urls__expand_tricky_parameters_for_tags_($c0dff3){ $z9299d=array(); $parameters=array(); foreach ($c0dff3 as $rb19ad){ $k72487=''; if (!isset ($rb19ad['__noalias!'])) { if (isset ($rb19ad['tag-alias'])) { $k72487=$rb19ad['tag-alias']; } else { $k72487=e2_active_alias_for_page_(ENTITY_TYPE_TAG,$rb19ad['ID']); } } $z9299d[] = $k72487? $k72487:$rb19ad['OriginalAlias']; } if(count($c0dff3)) { $parameters['tag-alias']=implode(',',$z9299d); } return$parameters; } function e2urls__consolidate_tricky_parameters_($parameters){ if ( (string) @$parameters['alias']!=='' or ( (string) @$parameters['year']!=='' and (string) @$parameters['month']!=='' and (string) @$parameters['day']!=='' and (string) @$parameters['day-number']!=='' ) ) { if ($saad65=e2_published_noterec_with_parameters_($parameters)) { $parameters['*note']=$saad65; } } if ( (string) @$parameters['oalias']!=='' or (string) @$parameters['draft']!=='' or (string) @$parameters['oalias2']!=='' or (string) @$parameters['draft2']!=='' ){ if ($saad65=e2_noterec_with_parameters_($parameters)) { $parameters['*note']=$saad65; } } if ( (string) @$parameters['tag-alias']!=='' ){ $parameters['*tags']=e2_tagrecs_with_parameters_($parameters); if(count($parameters['*tags']) == 1){ $parameters['*tag']=$parameters['*tags'][0]; } } return$parameters; } function p3aa5($i9dd4e){ global$_e2utf8__unformat_htmlentity_neasden; if($_e2utf8__unformat_htmlentity_neasden){ return $i9dd4e; } else { return '((html '. $i9dd4e .'))'; } } function medd9($re98a6,$j98df3=false){ $s80a41=''; $tf5a8e=strlen($re98a6); for ($f865c0=0; $f865c0 < 256; ++ $f865c0){ $sf3d13[$f865c0]=0; $r0fc3c=$f865c0; while ($r0fc3c & 0x00000080){ $r0fc3c <<= 1; ++ $sf3d13[$f865c0]; } } for ($f865c0=0xd090; $f865c0 <= 0xd0bf; $f865c0++)$y84a26[$f865c0]=chr(($f865c0 & 0x000000ff)+48); for ($f865c0=0xd180; $f865c0 <= 0xd18f; $f865c0++)$y84a26[$f865c0]=chr(($f865c0 & 0x000000ff)+112); $y84a26[0xd081]="\xa8"; $y84a26[0xd191]="\xb8"; $y84a26[0xc299]="\x99"; $y84a26[0xc2a9]="\xa9"; $y84a26[0xc2ae]="\xae"; $y84a26[0xc2ab]="\xab"; $y84a26[0xc2bb]="\xbb"; $y84a26[0xc2a0]="\xa0"; $f865c0=0; while ($f865c0 < $tf5a8e){ $zac558=$re98a6[$f865c0]; $hc267c=ord($zac558); if ($sf3d13[$hc267c]==0){ $s80a41.=$zac558; ++ $f865c0; } elseif ($sf3d13[$hc267c]==2){ $r06214=$y84a26[($hc267c << 8) | ord($re98a6[$f865c0+1])]; $s80a41 .= ($r06214!=null)? $r06214 : ( $j98df3? (p3aa5( cebe5(substr($re98a6,$f865c0,2)) )) : '?' ); $f865c0+=2; } else { $rdfbc9=substr($re98a6,$f865c0,$sf3d13[$hc267c]); if ($rdfbc9=="\xe2\x84\x96")$s80a41.="\xb9"; elseif ($rdfbc9=="\xe2\x80\x93")$s80a41.="\x96"; elseif ($rdfbc9=="\xe2\x80\x94")$s80a41.="\x97"; elseif ($rdfbc9=="\xe2\x80\x98")$s80a41.="\x91"; elseif ($rdfbc9=="\xe2\x80\x99")$s80a41.="\x92"; elseif ($rdfbc9=="\xe2\x80\x9a")$s80a41.="\x82"; elseif ($rdfbc9=="\xe2\x80\x9c")$s80a41.="\x93"; elseif ($rdfbc9=="\xe2\x80\x9d")$s80a41.="\x94"; elseif ($rdfbc9=="\xe2\x80\x9e")$s80a41.="\x84"; elseif ($rdfbc9=="\xe2\x80\xa6")$s80a41.="\x85"; elseif ($rdfbc9=="\xe2\x80\xb9")$s80a41.="\x8b"; elseif ($rdfbc9=="\xe2\x80\xba")$s80a41.="\x9b"; elseif ($rdfbc9=="\xe2\x82\xac")$s80a41.="\x88"; elseif ($rdfbc9=="\xe2\x84\xa2")$s80a41.="\x99"; else $s80a41.=$j98df3? (p3aa5( cebe5($rdfbc9) )) : '?'; $f865c0+=$sf3d13[$hc267c]; } } return $s80a41; } function cebe5($c4a8a0){ $icc411=''; $tf5a8e=strlen($c4a8a0); for ($f865c0=0; $f865c0 < $tf5a8e; ++ $f865c0){ $icc411.=preg_replace('/^1*0/','',decbin(ord($c4a8a0[$f865c0]))); } return '&#'. bindec($icc411) .';'; } function ffd97($w341be) { $r2cb9d=$w341be; $r2cb9d=preg_replace_callback('/([\x80-\xFF])/','e2_utf_from_windows_1251_char',$r2cb9d); return $r2cb9d; } function e2_utf_from_windows_1251_char($c4a8a0){ list (, $c4a8a0)=$c4a8a0; if ($c4a8a0=="\xa8") return "\xd0\x81"; if ($c4a8a0=="\xb8") return "\xd1\x91"; if ($c4a8a0 >= "\xc0" && $c4a8a0 <= "\xef") return "\xd0".chr(ord($c4a8a0)-48); if ($c4a8a0 >= "\xf0") return "\xd1".chr(ord($c4a8a0)-112); if ($c4a8a0=="\x85") return "\xe2\x80\xa6"; if ($c4a8a0=="\x96") return "\xe2\x80\x93"; if ($c4a8a0=="\x97") return "\xe2\x80\x94"; if ($c4a8a0=="\xab") return "\xc2\xab"; if ($c4a8a0=="\xbb") return "\xc2\xbb"; if ($c4a8a0=="\x91") return "\xe2\x80\x98"; if ($c4a8a0=="\x92") return "\xe2\x80\x99"; if ($c4a8a0=="\x93") return "\xe2\x80\x9c"; if ($c4a8a0=="\x94") return "\xe2\x80\x9d"; if ($c4a8a0=="\x84") return "\xe2\x80\x9e"; if ($c4a8a0=="\x99") return "\xe2\x84\xa2"; if ($c4a8a0=="\xb9") return "\xe2\x84\x96"; if ($c4a8a0=="\xa0") return "\xc2\xa0"; return '?'; }; function e2_utf8_version_of_array_($cf1f71){ foreach ($cf1f71 as $d8ce4b => $t9e366){ if (!array_key_exists($d8ce4b.'.u?',$cf1f71)) { if(is_string($cf1f71[$d8ce4b])) { $cf1f71[$d8ce4b]=ffd97($cf1f71[$d8ce4b]); } elseif(is_array($cf1f71[$d8ce4b])) { $cf1f71[$d8ce4b]=e2_utf8_version_of_array_($cf1f71[$d8ce4b]); } } } return $cf1f71; } function n869e($t6f8f5){ return mb_convert_encoding($t6f8f5[0],'HTML-ENTITIES','UTF-8'); } function uff7c($w341be,$m22019=false){ if ($m22019){ return preg_replace_callback( '/[\x{10000}-\x{fffff}]/u','e2_question_long_utf8_chars_helper',$w341be ); } else { return preg_replace('/[\x{10000}-\x{fffff}]/u','?',$w341be); } } function e2img_filename_by_processing( $mfce75,$e1c925, $a26635,$xcff96,$ud6663 ){ global$_config; if(Log::$ned2b5)__log('Process image: "'. $mfce75 .'" -> "'. $e1c925 .'"'); if (!is_file($mfce75)) return false; $c9c26d=stat($mfce75)['size']; if (!hb6c5($mfce75)) { if(Log::$ned2b5)__log('Process image: SVG, no processing'); return $mfce75; } if(is_file($e1c925) and !w4f9d($mfce75,$e1c925)) { if(Log::$ned2b5)__log('Process image: Already exists'); return $e1c925; } if (!extension_loaded('gd')) return false; $n7ae08=pathinfo($e1c925); if (!@eaf42($n7ae08['dirname'])) { if(Log::$ned2b5)__log( 'Process image: Cant create directory <'. $n7ae08['dirname'] .'>' ); return false; } if(Log::$ned2b5)__log('Process image: Detecting image type'); $type=e2img__type_of_file($mfce75); if (!$type) return false; $m94ba2='imagecreatefrom'. $type; if (!function_exists($m94ba2)) return false; if(Log::$ned2b5)__log('Process image: Opening original image ('. $m94ba2 .')'); $b1ccee=call_user_func($m94ba2,$mfce75); if (!$b1ccee) return false; if ($m89918=e2img__orientation_of_file($mfce75)) { if(Log::$ned2b5)__log('Process image: Needs orientation fix'); $b1ccee=e2img__res_rotate($b1ccee, -$m89918); } $d6af77=[imagesx($b1ccee),imagesy($b1ccee)]; $sb3e38=$d6af77; $hac50f=[0,0,0,0]; if ($xcff96==CROP_SQUARE){ if(Log::$ned2b5)__log('Process image: Needs crop'); list ($sb3e38,$hac50f) = ( e2img__crop_metrics_to_square($sb3e38) ); } $sb3e38=e2_fit_metrics_to_constraints( $sb3e38,$a26635 ); if ( $m89918===0 and $sb3e38===$d6af77 ){ if(Log::$ned2b5)__log('Process image: No changes necessary, leaving original'); return $mfce75; } if(Log::$ned2b5)__log(var_export($sb3e38,true)); if(Log::$ned2b5)__log(var_export($hac50f,true)); $o26ea7=e2img__create_copy_resampled( $b1ccee, $sb3e38, $hac50f, $type ); imagejpeg($o26ea7,$e1c925,$ud6663); if (!is_file($e1c925)) { if(Log::$ned2b5)__log('Process image: File not created by imagejpeg'); return false; } if ($m89918===0){ $o46c12=stat($e1c925)['size']; if ($o46c12 >= $c9c26d){ if(Log::$ned2b5)__log('Process image: Conversion to JPEG made file bigger, back up'); unlink($e1c925); $e1c925=$mfce75; } } @chmod($e1c925,$_config['uploaded_files_mode']); if(Log::$ned2b5)__log('Process image: Done'); return $e1c925; } function e2img__create_copy_resampled( $b1ccee,$sb3e38,$hac50f,$type ){ list ($rd4d55,$q455ce)=$sb3e38; list ($p98453,$v2aaef,$db40c7,$l0a71b)=$hac50f; $o26ea7=imagecreatetruecolor($rd4d55,$q455ce); if($type==='png'){ imagefill($o26ea7,0,0,imagecolorallocate($o26ea7,255,255,255)); imagealphablending($o26ea7,true); } $x2097d=imagesx($b1ccee); $i97874=imagesy($b1ccee); imagecopyresampled( $o26ea7, $b1ccee, 0,0, 0+$p98453,0+$v2aaef, $rd4d55,$q455ce, $x2097d-$db40c7,$i97874-$l0a71b ); imageinterlace($o26ea7,1); return $o26ea7; } function e2img__type_of_file($j435ed){ $scaf9b=@getimagesize($j435ed); if (!$scaf9b or $scaf9b[2] > 3) return false; if ($scaf9b[2]==IMAGETYPE_GIF) return 'gif'; if ($scaf9b[2]==IMAGETYPE_JPEG) return 'jpeg'; if ($scaf9b[2]==IMAGETYPE_PNG) return 'png'; return false; } function e2img__orientation_of_file($j435ed){ if (!function_exists('exif_read_data')) return 0; if (($a9beff=@exif_read_data($j435ed)) === false) return 0; if ($a9beff['Orientation']==3) return -180; if ($a9beff['Orientation']==6) return -270; if ($a9beff['Orientation']==8) return -90; return 0; } function e2img__res_rotate($s9b207,$m89918){ $a65370=imagerotate($s9b207,$m89918,0); if ($a65370!==false){ imagedestroy($s9b207); $s9b207=$a65370; } return $s9b207; } function e2_fit_metrics_to_constraints( $u0b73d,$a26635 ){ if ($a26635===false)$a26635=[0,0]; list ($veaae2,$fb435e)=$u0b73d; list ($wdb99b,$f4278c)=$a26635; $m8e7bb=[1]; if ($wdb99b)$m8e7bb[] = $wdb99b/$veaae2; if ($f4278c)$m8e7bb[] = $f4278c/$fb435e; $o0cb47=min($m8e7bb); if ($o0cb47 < 1){ $veaae2=(int)round($veaae2*$o0cb47); $fb435e=(int)round($fb435e*$o0cb47); } return [$veaae2,$fb435e]; } function e2img__crop_metrics_to_square($u0b73d){ $v81188=$cb2835=$q4505c=$me6dec=0; list ($veaae2,$fb435e)=$u0b73d; if ($veaae2 > $fb435e){ $q4505c=$veaae2-$fb435e; $v81188=floor($q4505c/2); $fb435e=$veaae2; } elseif ($veaae2 < $fb435e){ $me6dec=$fb435e-$veaae2; $cb2835=floor($q4505c/2); $veaae2=$fb435e; } $hac50f=[$v81188,$cb2835,$q4505c,$me6dec]; $q27e5c=[$veaae2,$fb435e]; return [$q27e5c,$hac50f]; } $_folders_written=array ( '.', USER_FOLDER, CACHES_FOLDER, BACKUP_FOLDER, LOG_FOLDER, MEDIA_ROOT_FOLDER.PICTURES_FOLDER, MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER, MEDIA_ROOT_FOLDER.PICTURES_FOLDER .'remote/', MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER .'remote/', MEDIA_ROOT_FOLDER.AUDIO_FOLDER, MEDIA_ROOT_FOLDER.AVATARS_FOLDER, ); $_files_written=array ( USER_FOLDER.'password-hash.psa', USER_FOLDER.'password-wait.psa', USER_FOLDER.'last-comment.psa', USER_FOLDER.'new-uploads.psa', USER_FOLDER.'settings.json', USER_FOLDER.'indexing.psa', USER_FOLDER.'auth.psa', USER_FOLDER.'scheduled.psa', ); define('CROP_NONE',0); define('CROP_SQUARE',1); define('PROVIDE_DATA_SPAWN',10); define('PROVIDE_DATA_NOW',20); function jea70(){ global$_folders_written,$_files_written; clearstatcache(); $d10ae9=array(); foreach($_folders_written as $x8fa14){ if(is_dir($x8fa14) and !is_writable($x8fa14)) { $d10ae9[] = $x8fa14; } } foreach($_files_written as $x8fa14){ if(is_file($x8fa14) and !is_writable($x8fa14)) { $d10ae9[] = $x8fa14; } } return $d10ae9; } function k6e52($d8c7dd,$fb45cf){ @eaf42(dirname($d8c7dd)); if (!@file_put_contents($d8c7dd,$fb45cf,LOCK_EX)) { return false; } @chmod($d8c7dd,E2_NEW_FILES_RIGHTS); return true; } function m1cae($o954eb){ if(preg_match('/^https?\:\/\//iu',$o954eb)) { $s6efa1=$o954eb; $s6efa1=preg_replace('/^https?\:\/\//iu','',$s6efa1); $s6efa1=str_replace('/','--',$s6efa1); $s6efa1=MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER.$s6efa1; } else { $s6efa1=MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER.$o954eb; } $s6efa1=e2files__add_ext_prefix($s6efa1,'thumb@2x'); return $s6efa1; } function c6e61($o954eb){ if(preg_match('/^https?\:\/\//iu',$o954eb)) { $jaf721=$o954eb; } else { $jaf721=MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$o954eb; } $s6efa1=e2img_filename_by_processing( $jaf721, m1cae($o954eb), [THUMB_WIDTH,THUMB_HEIGHT], CROP_NONE, THUMB_JPG_QUALITY ); if ($s6efa1===false) return false; $tf5a8e=strlen(MEDIA_ROOT_FOLDER); if(substr($s6efa1,0,$tf5a8e)==MEDIA_ROOT_FOLDER){ $e85133=substr($s6efa1,$tf5a8e); } return $e85133; } function c30f2($jaf721){ $c8743c=pathinfo($jaf721); $iabf77=$c8743c['extension']; return (in_array(strtolower($iabf77), array ('jpg','jpeg','gif','png','svg'))); } function hb6c5($jaf721){ $c8743c=pathinfo($jaf721); $iabf77=$c8743c['extension']; return (in_array(strtolower($iabf77), array ('jpg','jpeg','gif','png'))); } function gef67($jaf721){ $c8743c=pathinfo($jaf721); $iabf77=$c8743c['extension']; if ($iabf77=='png') return IMAGETYPE_PNG; if ($iabf77=='gif') return IMAGETYPE_GIF; if ($iabf77=='jpg' or $iabf77=='jpeg') return IMAGETYPE_JPEG; } function oc952($jaf721){ $c8743c=pathinfo($jaf721); $iabf77=$c8743c['extension']; if ($iabf77=='png') return 'image/png'; if ($iabf77=='gif') return 'image/gif'; if ($iabf77=='jpg' or $iabf77=='jpeg') return 'image/jpeg'; if ($iabf77=='mp3') return 'audio/mpeg'; } function d19a4($j435ed){ if (hb6c5($j435ed)) { list ($veaae2,$fb435e)=getimagesize($j435ed); } else { $ge2da9=simplexml_load_string(file_get_contents($j435ed)); if ($ge2da9){ $hd0a5e=$ge2da9->attributes(); list ($veaae2,$fb435e) = array ((string)$hd0a5e -> width, (string)$hd0a5e -> height); } else { return false; } } if(substr($j435ed,strrpos($j435ed,'.')-3,3)=='@2x'){ $veaae2=(int)floor($veaae2/2); $fb435e=(int)floor($fb435e/2); } return array ($veaae2,$fb435e); } function e2s_retrieve($parameters){ $h36cd3=urldecode(base64_decode($parameters['url'])); if(Log::$ned2b5)__log('Retrieve: '. $h36cd3); c1066($h36cd3,PROVIDE_DATA_NOW); } function pd222($r447b7){ global$full_blog_url; $w78f08=parse_url($r447b7); if (isset ($w78f08['host'])) { if ($w78f08['host']=='www.youtube.com'){ $xb80bb=basename($w78f08['path']); $s15ba8='remote/youtube-'. $xb80bb .'-cover.jpg'; return array ( 'type' => 'online-video', 'is-local?' => false, 'is-rss-enclosure?' => false, 'video-service' => 'youtube', 'video-id' => $xb80bb, 'local-cover-name' => $s15ba8, 'local-cover-href' => $full_blog_url .'/'. PICTURES_FOLDER.$s15ba8, 'local-full-filename' => MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$s15ba8, 'local-full-failname' => MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$s15ba8.'.failed', ); } elseif ($w78f08['host']=='player.vimeo.com'){ $xb80bb=basename($w78f08['path']); $s15ba8='remote/vimeo-'. $xb80bb .'-cover.jpg'; return array ( 'type' => 'online-video', 'is-local?' => false, 'is-rss-enclosure?' => false, 'video-service' => 'vimeo', 'video-id' => $xb80bb, 'local-cover-name' => $s15ba8, 'local-cover-href' => $full_blog_url .'/'. PICTURES_FOLDER.$s15ba8, 'local-full-filename' => MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$s15ba8, 'local-full-failname' => MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$s15ba8.'.failed', ); } elseif (c30f2($w78f08['path'])) { return array ( 'type' => 'remote-image', 'is-local?' => false, 'is-rss-enclosure?' => false, 'url' => $r447b7, 'mime-type' => oc952($w78f08['path']), 'length' => '', ); } else { return array ( 'type' => 'remote-non-image', 'is-local?' => false, 'is-rss-enclosure?' => true, 'url' => $r447b7, 'mime-type' => oc952($w78f08['path']), 'length' => '', ); } } else { if (c30f2($w78f08['path'])) { $sb6d7a=MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$w78f08['path']; return array ( 'type' => 'local-image', 'is-local?' => true, 'is-rss-enclosure?' => false, 'url' => $full_blog_url .'/'. PICTURES_FOLDER.$w78f08['path'], 'mime-type' => oc952($w78f08['path']), 'length' => @stat($sb6d7a)['size'], 'local-href' => $full_blog_url .'/'. PICTURES_FOLDER.$w78f08['path'], 'local-full-filename' => $sb6d7a, ); } else { $sb6d7a=MEDIA_ROOT_FOLDER.AUDIO_FOLDER.$w78f08['path']; return array ( 'type' => 'local-non-image', 'is-local?' => true, 'is-rss-enclosure?' => true, 'url' => $full_blog_url .'/'. AUDIO_FOLDER.$w78f08['path'], 'mime-type' => oc952($w78f08['path']), 'length' => @stat($sb6d7a)['size'], 'local-href' => $full_blog_url .'/'. AUDIO_FOLDER.$w78f08['path'], 'local-full-filename' => $sb6d7a, ); } } } function c1066($r447b7,$ydb88a){ $t1c149=pd222($r447b7); if ($t1c149['type']=='remote-image'){ } elseif ($t1c149['type']=='online-video'){ if(is_file($t1c149['local-full-filename'])) { if(Log::$ned2b5)__log('Already exists: '. $t1c149['local-full-filename']); } elseif(is_file($t1c149['local-full-failname'])) { if(Log::$ned2b5)__log('Already tried and failed: '. $t1c149['local-full-filename']); } else { if(Log::$ned2b5)__log($r447b7.' is missing a cover, retrieving'); if ($ydb88a==PROVIDE_DATA_SPAWN){ gcc38(x83c8('e2s_retrieve', array ( 'url' => urlencode(base64_encode($r447b7)), ))); } if ($ydb88a==PROVIDE_DATA_NOW){ if ($t1c149['video-service']=='youtube') { $v5f89d=array ( 'maxresdefault','hqdefault','mqdefault','sddefault','default' ); foreach ($v5f89d as $zd7d16){ $t572d4='http://img.youtube.com/vi/'. $t1c149['video-id'] .'/'. $zd7d16 .'.jpg'; if(Log::$ned2b5)__log('Getting '.$t572d4 .' as '. $t1c149['local-full-filename']); $l6c43d=file_get_contents($t572d4); if ($l6c43d!==false) break; } } if ($t1c149['video-service']=='vimeo') { $oc4a72=unserialize( file_get_contents('http://vimeo.com/api/v2/video/'. $t1c149['video-id'] .'.php') ); if (isset ($oc4a72[0]['thumbnail_large'])) { $l6c43d=file_get_contents($oc4a72[0]['thumbnail_large']); } } if ($l6c43d!==false){ k6e52($t1c149['local-full-filename'],$l6c43d); } else { k6e52($t1c149['local-full-failname'],''); } } } if ($ydb88a==PROVIDE_DATA_NOW){ if(is_file($t1c149['local-full-filename'])) { c6e61($t1c149['local-cover-name']); } } } elseif ($t1c149['type']=='local-image'){ if(Log::$ned2b5)__log($r447b7.' is a local image'); c6e61($r447b7); } elseif ($t1c149['type']=='local-non-image'){ if(Log::$ned2b5)__log($r447b7.' is a local non-image'); } } function t6be4($d10ae9){ if (!is_array($d10ae9)) return; if(Log::$ned2b5)__log('Provide data for resources {'); foreach ($d10ae9 as $r447b7){ c1066($r447b7,PROVIDE_DATA_SPAWN); } if(Log::$ned2b5)__log('}'); } function hf898($l89111,$rdffc4,$se449c){ $c5128f=p1722($l89111,$rdffc4); $y55b55=array_merge($c5128f,$se449c); $y55b55=array_reverse($y55b55); $y55b55=array_unique($y55b55); $y55b55=array_reverse($y55b55); return b2e82($y55b55,RESOURCES_LOCAL); } function afc4d($yd430b,$o2bfe4){ $n84841=array(); if(is_array($o2bfe4['meta']['resources-detected'])) { $se449c=$o2bfe4['meta']['resources-detected']; $n84841=wdc5a($se449c); } $e16137=@unserialize( $yd430b['Uploads'] ) or $e16137=array(); $t08204=array_diff($n84841,$e16137); if(count($t08204) > 0){ l2cf0('note',$yd430b['ID'],'add',$t08204); } return $t08204; } function wdc5a($yd7f81){ $d10ae9=array(); foreach ($yd7f81 as $f1993e){ $t1c149=pd222($f1993e); if ($t1c149['is-local?'])$d10ae9[] = $f1993e; } return $d10ae9; } function b2e82($y55b55,$v8b7af=RESOURCES_ALL){ global$full_blog_url,$_strings; $fef067=array(); $v59b51=array(); if (!is_array($y55b55)) return $v59b51; t6be4($y55b55); foreach ($y55b55 as $o96ab4){ $t1c149=pd222($o96ab4); $f11b42=''; if ($t1c149['is-local?'] and is_file($t1c149['local-full-filename'])) { $f11b42=stat($t1c149['local-full-filename'])[7]; $f11b42=round($f11b42/1024) .' '. $_strings['gs--kb']; } if ($v8b7af==RESOURCES_LOCAL and !$t1c149['is-local?']) continue; if ($t1c149['type']=='remote-image'){ } elseif ($t1c149['type']=='remote-non-image'){ } elseif ($t1c149['type']=='online-video'){ if ($q742c4=c6e61($t1c149['local-cover-name'])) { $size=d19a4(MEDIA_ROOT_FOLDER.$q742c4); list ($veaae2,$fb435e)=$size; if (!in_array($o96ab4,$fef067)) { $fef067[] = $o96ab4; $v59b51[] = array ( 'original-filename' => $o96ab4, 'href' => $full_blog_url .'/'. $q742c4, 'width' => $veaae2, 'height' => $fb435e, ); } } } elseif ($t1c149['type']=='local-image'){ if ($q742c4=c6e61($o96ab4)) { $size=d19a4(MEDIA_ROOT_FOLDER.$q742c4); list ($veaae2,$fb435e)=$size; if (!$veaae2)$veaae2=THUMB_WIDTH/2; if (!$fb435e)$fb435e=THUMB_HEIGHT/2; list ($veaae2,$fb435e)=e2_fit_metrics_to_constraints( [$veaae2,$fb435e], [THUMB_WIDTH/2,THUMB_HEIGHT/2] ); if (!in_array($o96ab4,$fef067)) { $fef067[] = $o96ab4; $v59b51[] = array ( 'original-filename' => $o96ab4, 'original-filesize' => $f11b42, 'href' => $full_blog_url .'/'. $q742c4, 'width' => $veaae2, 'height' => $fb435e, ); } } else { if (!in_array($o96ab4,$fef067)) { $fef067[] = $o96ab4; $v59b51[] = array ( 'original-filename' => $o96ab4, 'original-filesize' => '', 'href' => $full_blog_url .'/'. m1cae($o96ab4), 'width' => 0, 'height' => 0, ); } } } elseif ($t1c149['type']=='local-non-image'){ if(is_file(MEDIA_ROOT_FOLDER.AUDIO_FOLDER.$o96ab4)) { if (!in_array($o96ab4,$fef067)) { $fef067[] = $o96ab4; $v59b51[] = array ( 'original-filename' => $o96ab4, 'original-filesize' => $f11b42, 'href' => $full_blog_url .'/'. AUDIO_ICON_IMAGE, 'width' => AUDIO_ICON_WIDTH, 'height' => AUDIO_ICON_HEIGHT, ); } } else { if (!in_array($o96ab4,$fef067)) { $fef067[] = $o96ab4; $v59b51[] = array ( 'original-filename' => $o96ab4, 'original-filesize' => '', 'href' => $full_blog_url .'/'. AUDIO_ICON_IMAGE, 'width' => 0, 'height' => 0, ); } } } } return $v59b51; } function tdbcc($l89111,$rdffc4,$y55b55){ global$full_blog_url; $d10ae9=array(); if(is_array($y55b55)) { $d10ae9=e2files__list_og_images_for_resources_($y55b55); } $c5128f=p1722($l89111,$rdffc4); if(is_array($c5128f)) { foreach ($c5128f as $d8ce4b => $t9e366){ if(is_file(MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$t9e366)) { $c5128f[$d8ce4b]=$full_blog_url .'/'. PICTURES_FOLDER.$t9e366; } else { unset ($c5128f[$d8ce4b]); } } $d10ae9=array_merge($c5128f,$d10ae9); } $d10ae9=array_reverse($d10ae9); $d10ae9=array_unique($d10ae9); $d10ae9=array_reverse($d10ae9); return $d10ae9; } function e2files__list_og_images_for_resources_($y55b55){ $v59b51=array(); t6be4($y55b55); foreach ($y55b55 as $o96ab4){ $t1c149=pd222($o96ab4); if ($t1c149['type']=='remote-image'){ } elseif ($t1c149['type']=='remote-non-image'){ } elseif ($t1c149['type']=='online-video'){ if(is_file($t1c149['local-full-filename'])) { $v59b51[] = $t1c149['local-cover-href']; } } elseif ($t1c149['type']=='local-image'){ if(is_file($t1c149['local-full-filename'])) { $v59b51[] = $t1c149['local-href']; } } elseif ($t1c149['type']=='local-non-image'){ } } return $v59b51; } function a9c0a($vb0689,$l12e09){ $vb0689=l2183($vb0689); if(preg_match('//u',$vb0689))$vb0689=medd9($vb0689,false); if ($l12e09=='image'){ $y85114=MEDIA_ROOT_FOLDER.PICTURES_FOLDER; } elseif ($l12e09=='audio'){ $y85114=MEDIA_ROOT_FOLDER.AUDIO_FOLDER; } else { return false; } $f96704=''; for ($f865c0=0; $f865c0 < strlen($vb0689); $f865c0++) { if ($vb0689[$f865c0]=='?'){ $f96704.=''; } elseif ($vb0689[$f865c0]==' '){ $f96704.='-'; } elseif(ord($vb0689[$f865c0]) <= 127){ $f96704.=$vb0689[$f865c0]; } } if ($f96704=='')$f96704=$l12e09; if ($f96704[0]=='.')$f96704=$l12e09.$f96704; return $f96704; } function mf0fb($z76ee3){ global$_config; if(Log::$ned2b5)__log('Count references for upload <'. $z76ee3 .'>'); if(is_file(USER_FOLDER.'new-uploads.psa')) { $e7cd94=@unserialize(file_get_contents(USER_FOLDER.'new-uploads.psa')); } $c5a976='%'. str_replace('%','#%',$z76ee3) .'%'; u0738( "SELECT `ID`, `Text`, `FormatterID`, `Uploads` ". "FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (`Text` LIKE '". $c5a976 ."' ESCAPE '#' ". "OR `Uploads` LIKE '". $c5a976 ."' ESCAPE '#')", 'get notes where uploads may be referenced' ); $result=d0d6b(); $jbe270=@unserialize($result[0]['Uploads']); if (!is_array($jbe270)) { foreach($result as $w39a37){ $o2bfe4=j154e( $w39a37['FormatterID'], @$w39a37['Text'],'full-rss' ); $jbe270=afc4d($w39a37,$o2bfe4); } } u0738( "SELECT `ID`, `Description`, `Uploads` ". "FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (`Description` LIKE '". $c5a976 ."' ESCAPE '#' ". "OR `Uploads` LIKE '". $c5a976 ."' ESCAPE '#')", 'get tags where uploads may be referenced' ); $result=d0d6b(); $k6ae44=@unserialize($result[0]['Uploads']); if (!is_array($k6ae44)) { foreach($result as $rb19ad){ $o2bfe4=bb7f1( @$rb19ad['Description'],'full-rss' ); $k6ae44=afc4d($rb19ad,$o2bfe4); } } if (!is_array($e7cd94))$e7cd94=[]; if (!is_array($jbe270))$jbe270=[]; if (!is_array($k6ae44))$k6ae44=[]; $c5128f=array_merge($e7cd94,$jbe270,$k6ae44); if(Log::$ned2b5)__log('References found in relevant entries: '. var_export($c5128f,true)); if(in_array($z76ee3,$c5128f)) { if(Log::$ned2b5)__log('Still referenced, do not delete file'); return true; } return false; } function p1722($tf5e63,$xb80bb){ global$_config; if ($tf5e63=='note' and $xb80bb=='new'){ if(is_file(USER_FOLDER.'new-uploads.psa')) { $c5128f=@unserialize(file_get_contents(USER_FOLDER.'new-uploads.psa')); } } elseif ($tf5e63=='note'){ u0738( "SELECT `Uploads` FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $xb80bb ); $result=d0d6b(); $c5128f=@unserialize($result[0]['Uploads']); } elseif ($tf5e63=='tag'){ u0738( "SELECT `Uploads` FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $xb80bb ); $result=d0d6b(); $c5128f=@unserialize($result[0]['Uploads']); } if (!is_array($c5128f))$c5128f=array(); return $c5128f; } function ucbba($tf5e63,$xb80bb,$c5128f){ global$_config; if ($tf5e63=='note' and $xb80bb=='new'){ if (!@k6e52(USER_FOLDER.'new-uploads.psa',serialize($c5128f))) { q8a40('ERROR',E2E_PERMISSIONS_ERROR); } } elseif ($tf5e63=='note'){ u0738( "UPDATE `". $_config['db_table_prefix']."Notes` ". "SET `Uploads`='". serialize($c5128f) ."' ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $xb80bb ); } elseif ($tf5e63=='tag'){ u0738( "UPDATE `". $_config['db_table_prefix']."Keywords` ". "SET `Uploads`='". serialize($c5128f) ."' ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $xb80bb ); } else { return false; } if (!is_array($c5128f))$c5128f=array(); return $c5128f; } function l2cf0($tf5e63,$xb80bb,$action,$u4a202){ global$_config; $c5128f=array(); if(Log::$ned2b5)__log('Register upload: <'. $tf5e63.', '. $xb80bb.', '. $action.', '. $u4a202 .'>'); $c5128f=p1722($tf5e63,$xb80bb); $c5128f=te1e7($c5128f,$action,$u4a202); ucbba($tf5e63,$xb80bb,$c5128f); } function t2f83($f4b27b,$sde17f,$se449c){ $e16137=@unserialize($sde17f['Uploads']) or $e16137=array(); $d28a47=wdc5a($se449c); $c5128f=te1e7($e16137,'add',$d28a47); $c5128f=serialize($c5128f); if ($c5128f!=$sde17f['Uploads']) { $sde17f['Uploads']=$c5128f; qaa79($f4b27b,$sde17f); } } function e2j_file_upload($parameters=array ()) { global$_config,$full_blog_url,$_strings; @eaf42(MEDIA_ROOT_FOLDER.PICTURES_FOLDER); @chmod(MEDIA_ROOT_FOLDER.PICTURES_FOLDER,$_config['uploaded_files_mode']); @eaf42(MEDIA_ROOT_FOLDER.AUDIO_FOLDER); @chmod(MEDIA_ROOT_FOLDER.AUDIO_FOLDER,$_config['uploaded_files_mode']); $gd1fc8=[ 'success' => false ]; if(count($_FILES) > 0){ foreach($_FILES as $d8c7dd){ if (!$d8c7dd['error']) { if(Log::$ned2b5)__log('Ajax file upload: <'. $d8c7dd['name'].'>'); $gd1fc8['data']['file-kind']='image'; $y85114=MEDIA_ROOT_FOLDER.PICTURES_FOLDER; if(substr($d8c7dd['name'],strrpos($d8c7dd['name'],'.')) == '.mp3'){ $gd1fc8['data']['file-kind']='audio'; $y85114=MEDIA_ROOT_FOLDER.AUDIO_FOLDER; } $u77dce=( array_key_exists('overwrite',$_GET) and is_file($y85114.$d8c7dd['name']) ); $s6f4b5=false; $gd1fc8['data']['overwrite'] = (int)$u77dce; if(Log::$ned2b5)__log('Ajax file upload: Overwrite is resolved to <'. (int)$u77dce.'>'); $f96704=a9c0a($d8c7dd['name'],$gd1fc8['data']['file-kind']); if(Log::$ned2b5)__log('Ajax file upload: Safe name is <'. $f96704.'>'); if(is_file($y85114.$f96704)) { if(file_get_contents($y85114.$f96704)==file_get_contents($d8c7dd['tmp_name'])) { if(Log::$ned2b5)__log('Ajax file upload: Existing file is the same'); $s6f4b5=true; } elseif (!$u77dce){ $f96704=e2files__find_free_filename($y85114,$f96704); } } if (!$s6f4b5){ move_uploaded_file($d8c7dd['tmp_name'],$y85114.$f96704); @chmod($y85114.$f96704,$_config['uploaded_files_mode']); } if(Log::$ned2b5)__log('Ajax file upload: File kind is <'. $gd1fc8['data']['file-kind'].'>'); if ($gd1fc8['data']['file-kind']=='image'){ $na28be=e2files__find_free_filename_with_added_ext( MEDIA_ROOT_FOLDER.PICTURES_FOLDER, $f96704,'jpg' ); $nb1cee=MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$f96704; $h093b5=MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$na28be; if(Log::$ned2b5)__log('Ajax file upload: Process uploaded image <'. $nb1cee.'>'. ' to possibly <'. $h093b5.'>'); $h093b5=e2img_filename_by_processing( $nb1cee, $h093b5, [ $_config['fit_uploaded_images'], $_config['fit_uploaded_images'], ], CROP_NONE, SCALED_IMAGE_JPG_QUALITY ); $f11b42=$d8c7dd['size']; if (!w4f9d($h093b5,$nb1cee)) { @unlink($nb1cee); $f96704=$na28be; $f11b42=stat($h093b5)['size']; } if ($u77dce){ @unlink(m1cae($f96704)); } if ($q742c4=c6e61($f96704)) { if(Log::$ned2b5)__log('Ajax file upload: thumbnail, done'); list ($veaae2,$fb435e)=d19a4(MEDIA_ROOT_FOLDER.$q742c4); if (!$veaae2)$veaae2=THUMB_WIDTH/2; if (!$fb435e)$fb435e=THUMB_HEIGHT/2; list ($veaae2,$fb435e)=e2_fit_metrics_to_constraints( [$veaae2,$fb435e], [THUMB_WIDTH/2,THUMB_HEIGHT/2] ); $gd1fc8['success']=true; $gd1fc8['data']['new-name']=$f96704; $gd1fc8['data']['filesize']=round($f11b42/1024) .' '. $_strings['gs--kb']; $gd1fc8['data']['thumb']=$full_blog_url .'/'. $q742c4; $gd1fc8['data']['width']=$veaae2; $gd1fc8['data']['height']=$fb435e; l2cf0($parameters['entity'],$parameters['entity-id'],'add', array ($f96704)); } else { if(Log::$ned2b5)__log('Ajax file upload: couldnt create thumbnail'); @unlink($y85114.$f96704); $gd1fc8['error']['message']=_S('er--cannot-create-thumbnail'); } } if ($gd1fc8['data']['file-kind']=='audio'){ if(Log::$ned2b5)__log('Ajax file upload: audio, done'); $gd1fc8['success']=true; $gd1fc8['data']['new-name']=$f96704; $gd1fc8['data']['filesize']=round($d8c7dd['size']/1024) .' '. $_strings['gs--kb']; $gd1fc8['data']['thumb']=AUDIO_ICON_IMAGE; $gd1fc8['data']['width']=AUDIO_ICON_WIDTH; $gd1fc8['data']['height']=AUDIO_ICON_HEIGHT; l2cf0($parameters['entity'],$parameters['entity-id'],'add', array ($f96704)); } } elseif(4!=$d8c7dd['error']) { if ($d8c7dd['error']==1){ $gd1fc8['error']['message']='too-big'; } elseif ($d8c7dd['error']==2){ $gd1fc8['error']['message']='too-big'; } elseif ($d8c7dd['error']==3){ $gd1fc8['error']['message']='partial'; } else { $gd1fc8['error']=$d8c7dd['error']; } } } } else { if(Log::$ned2b5)__log('Ajax file upload error: no files'); $gd1fc8['error']['message']='no-files'; } $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } function g8bd1(){ @unlink(USER_FOLDER.'[email protected]'); @unlink(USER_FOLDER.'[email protected]'); @unlink(USER_FOLDER.'[email protected]'); @unlink(USER_FOLDER.'[email protected]'); } function e2j_userpic_remove(){ if($_SERVER['REQUEST_METHOD']!='POST') return e2_go_to(x83c8('e2m_settings')); g8bd1(); $gd1fc8=json_encode([ 'success' => true ]); die ($gd1fc8); } function e2j_userpic_upload(){ global$_config; $gd1fc8=[ 'success' => false ]; if(count($_FILES)!=1){ if(Log::$ned2b5)__log('Ajax userpic upload error: no or too many files'); $gd1fc8['error']['message']='No or too many files'; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } $d8c7dd=array_pop($_FILES); if (!$d8c7dd['error']) { if(Log::$ned2b5)__log('Ajax userpic upload: <'. $d8c7dd['name'].'>'); $za93b8=pathinfo($d8c7dd['name']); $iabf77=strtolower($za93b8['extension']); if ($iabf77!='png')$iabf77='jpg'; $j435ed='userpic.original.'. $iabf77; move_uploaded_file($d8c7dd['tmp_name'],USER_FOLDER.$j435ed); @chmod(USER_FOLDER.$j435ed,$_config['uploaded_files_mode']); g8bd1(); copy( USER_FOLDER.$j435ed, USER_FOLDER .'[email protected]' ); $a48295=e2img_filename_by_processing( USER_FOLDER .'[email protected]', USER_FOLDER .'[email protected]', [$_config['max_image_width'],$_config['max_image_width']], CROP_NONE, USERPIC_JPG_QUALITY ); copy( USER_FOLDER.$j435ed, USER_FOLDER .'[email protected]' ); $y7d332=e2img_filename_by_processing( USER_FOLDER .'[email protected]', USER_FOLDER .'[email protected]', [$_config['max_image_width'],$_config['max_image_width']], CROP_SQUARE, USERPIC_JPG_QUALITY ); $tf1210=e2img_filename_by_processing( USER_FOLDER.$j435ed, USER_FOLDER .'[email protected]', [USERPIC_WIDTH,USERPIC_HEIGHT], CROP_SQUARE, USERPIC_JPG_QUALITY ); if ($y7d332){ $gd1fc8=[ 'success' => true, 'data' => [ 'new-image-src' => $y7d332, ] ]; } else { $gd1fc8['error']['message']=_S('er--unsupported-file-image'); } } elseif(4!=$d8c7dd['error']) { if ($d8c7dd['error']==1){ $gd1fc8['error']['message']='File too big'; } elseif ($d8c7dd['error']==2){ $gd1fc8['error']['message']='File too big'; } elseif ($d8c7dd['error']==3){ $gd1fc8['error']['message']='File upload is partial'; } else { $gd1fc8['error']['message']='File upload error '. $d8c7dd['error']; } } $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } function e2j_file_remove($parameters){ if (!array_key_exists('file',$_POST)) { $gd1fc8=[ 'success' => false ]; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } $d8c7dd=$_POST['file']; $gd1fc8=[ 'success' => true ]; $gd1fc8=json_encode($gd1fc8); l2cf0($parameters['entity'],$parameters['entity-id'],'remove',$d8c7dd); if (!mf0fb($d8c7dd)) { if(substr($d8c7dd,strrpos($d8c7dd,'.')) == '.mp3'){ @unlink(MEDIA_ROOT_FOLDER.AUDIO_FOLDER.$d8c7dd); } else { $tf1210=e2files__add_ext_prefix($d8c7dd,'thumb@2x'); $wf6347=@unlink(MEDIA_ROOT_FOLDER.PICTURES_FOLDER.$d8c7dd); $s8f458=@unlink(MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER.$tf1210); } } die ($gd1fc8); } function yd10e(){ global$_config; if (!$_config['files_total_size_limit']) return false; $a70a36=0; foreach(glob(MEDIA_ROOT_FOLDER.PICTURES_FOLDER .'/*') as $d8c7dd){ $i9dd4e=stat($d8c7dd); $a70a36+=$i9dd4e['size']; } foreach(glob(MEDIA_ROOT_FOLDER.AUDIO_FOLDER .'/*') as $d8c7dd){ $i9dd4e=stat($d8c7dd); $a70a36+=$i9dd4e['size']; } $gd515a=$_config['files_total_size_limit']; $z354f0=round($a70a36/$gd515a*100); if ($a70a36 > 0 and $z354f0==0)$z354f0=1; if ($a70a36 < $gd515a and $z354f0==100)$z354f0=99; return array ($a70a36,$gd515a,$z354f0); } function w4f9d($hbd198,$o3667f){ return strcasecmp($hbd198,$o3667f)===0; } function x1363($hc999b){ $f85faf=true; if (list ($a70a36,$gd515a,$z354f0)=$hc999b){ $f85faf=($gd515a-$a70a36) > 0; } return $f85faf; } function zaf64($hc999b,$gf9f90=false){ $sf3ecb=''; if (list ($a70a36,$gd515a,$z354f0)=$hc999b){ $hc999b=array ( 'used' => round($a70a36/1024/1024), 'total' => round($gd515a/1024/1024), 'percent' => $z354f0 ); if ($gf9f90 or ($gd515a-$a70a36) < 1024*1024*10){ if ($a70a36 < $gd515a){ $sf3ecb=e2l_get_string('gs--used',$hc999b); } else { $sf3ecb=e2l_get_string('gs--used-all',$hc999b); } } } return $sf3ecb; } function e2files__find_free_filename($y85114,$j435ed){ if (!is_file($y85114.$j435ed)) return $j435ed; $pe12a7=e2files__extless($j435ed); $iabf77=substr($j435ed,strrpos($j435ed,'.')); $f865c0=0; while (is_file($y85114.$pe12a7 .'-'. (++$f865c0).$iabf77)); $j435ed=$pe12a7 .'-'. $f865c0.$iabf77; return $j435ed; } function e2files__add_ext_prefix($j435ed,$f3dbb8){ if ($f3dbb8){ $x80127=explode('/',$j435ed); $o954eb=array_pop($x80127); $z35b88=explode('.',$o954eb); if(count($z35b88) < 2)$z35b88[] = ''; $iabf77=array_pop($z35b88); $z35b88[] = $f3dbb8; if ($iabf77)$z35b88[] = $iabf77; $o954eb=implode('.',$z35b88); $x80127[] = $o954eb; $j435ed=implode('/',$x80127); } return $j435ed; } function e2files__extless($j435ed){ return substr($j435ed,0,strrpos($j435ed,'.')); } function e2files__find_free_filename_with_added_ext($y85114,$j435ed,$g3cedd){ $iabf77=pathinfo($j435ed,PATHINFO_EXTENSION); if (!strcasecmp($iabf77,$g3cedd)) return $j435ed; return e2files__find_free_filename($y85114,$j435ed .'.'. $g3cedd); } function e2_error404_mode(){ global$_config,$_strings; if($_config['try_redirect_to_all']) { $i4a7dc='all/'. urldecode($_GET['go']); sb7e9($i4a7dc); } header('HTTP/1.1 404 Not found'); $we70c4['class']='404'; $we70c4['heading']=$_strings['pt--page-not-found']; $we70c4['title']=$_strings['pt--page-not-found']; return $we70c4; } function u6f10($a1cb25){ include_once 'neasden/neasden.php'; $Nn=new Neasden; $Nn->profile_name='kavychki'; return$Nn->format($a1cb25); } function rc0c4($af2ffc,$a1cb25,$n5c18e){ include_once 'neasden/neasden.php'; if ($a1cb25==='') return array (); if ($af2ffc=='calliope'){ preg_match_all('/\(\(([^ ]*)( |\)\))/',$a1cb25,$j9c28d); return $j9c28d[1]; } elseif ($af2ffc=='neasden'){ $Nn=new Neasden; $Nn->profile_name=$n5c18e; $Nn->format($a1cb25); return$Nn->resources_detected; } else { return array (); } } function j154e($af2ffc,$a1cb25,$n5c18e){ include_once 'neasden/neasden.php'; if(Log::$ned2b5)__log('Format: format with formatter "'. $af2ffc .'" in context "'. $n5c18e.'"'); if ($af2ffc=='calliope'){ $a1cb25=medd9($a1cb25); $a1cb25=o5599($a1cb25,$n5c18e); $meta=array(); $a1cb25=ffd97($a1cb25); $a1cb25='<div class="e2-text-calliope-formatted">'. u6f10($a1cb25) .'</div>'; } elseif ($af2ffc=='neasden'){ $Nn=new Neasden; $Nn->profile_name=$n5c18e; $a1cb25=$Nn->format($a1cb25); $meta=array ( 'links-required' => $Nn->links_required, 'resources-detected' => $Nn->resources_detected ); } return array ( 'text-final' => $a1cb25, 'meta' => $meta, ); } function bb7f1($a1cb25,$n5c18e){ global$_config; return j154e($_config['default_formatter'],$a1cb25,$n5c18e); } function o5599($a1cb25,$n5c18e){ global$_config,$settings,$full_blog_url,$_template; @ (list ($n5c18e,$xe8fab)=explode('|',$n5c18e)); require_once 'calliope/WikiFormatter.php'; if ('full'==$n5c18e)$fad910=WF_FULL_MODE; elseif ('full-rss'==$n5c18e)$fad910=WF_FULL_MODE; elseif ('simple'==$n5c18e)$fad910=WF_SIMPLE_MODE; elseif ('simple-rss'==$n5c18e)$fad910=WF_SIMPLE_MODE; else return $a1cb25; $i0a1d3=new WikiFormatter(); $i0a1d3 -> replace=array ( '/' => 'i', '+' => 'small', '-' => 's', '*' => 'b', '^' => 'sup', 'v' => 'sub', '#' => 'tt', '!' => 'blockquote', ); $i0a1d3 -> settings=array ( 'hrefSize' => 100, 'localImgDir' => $full_blog_url .'/'. PICTURES_FOLDER, 'maxImgWidth' => $_template['max_image_width'], 'mode' => $fad910, 'enableShrinkLongHref' => 1, 'enableHr' => 0, 'enableBr' => 1, 'enableHeaders' => 1, 'headersStartWith' => 1, 'enableTables' => 1, 'simpleTableCSSClass' => 'e2-text-table', 'enableAutoAcronymEngine' => 0, 'enableAcronym' => 0, 'acronymBase' => '', 'enableList' => 1, 'mailSafe' => "<a href=\"\" onmouseover=\"this.href='mailto:'+{email}\">{icon}<script language=\"JavaScript\">document.write({name});</script></a>", 'ljUserTag' => '<a href="http://livejournal.com/users/{name}/">{name}</a>', 'fullVersionURL' => $xe8fab, 'enableTagIcons' => 0, 'outerUrlInNewWindow' => 0, 'lineBreak' => "\n", 'extLinkHrefPrefix' => '', ); $a1cb25=$i0a1d3 -> Wiki2HTML($a1cb25); return $a1cb25; } function gcc38($t572d4){ if(Log::$ned2b5)__log('Spawn: Curl '. $t572d4 .'...'); if(function_exists('curl_init')) { $vf6e57=curl_init(); $e80e25=!ini_get('open_basedir'); curl_setopt_array($vf6e57, array ( CURLOPT_URL => $t572d4, CURLOPT_CONNECTTIMEOUT => 300, CURLOPT_TIMEOUT => 1, CURLOPT_MAXREDIRS => 1, CURLOPT_COOKIE => pc3fb(), CURLOPT_SSL_VERIFYPEER => false, CURLOPT_FOLLOWLOCATION => $e80e25, CURLOPT_RETURNTRANSFER => true, CURLOPT_AUTOREFERER => true, CURLOPT_USERAGENT => E2_UA_STRING, )); $content=curl_exec($vf6e57); $u70106=curl_errno($vf6e57); $p809b1=curl_error($vf6e57); $q099fb=curl_getinfo($vf6e57); curl_close($vf6e57); if(Log::$ned2b5)__log('Spawn: Curl returns: ['. print_r($q099fb,true) .'] ['. $content .'], (errno='. $u70106 .', errstr='. $p809b1 .')...'); } else { if(Log::$ned2b5)__log('Spawn: Curl functions are not available'); } } function b5b68($oea59a){ global$_config; if (@$_config['broadcast_url'] and !$oea59a['IsExternal']) { if($_config['log_broadcast']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('broadcast'); } if(Log::$ned2b5)__log('Broadcast-async note: '. $oea59a['Title']); $t572d4=x83c8('e2m_note_broadcast', array ('*note' => $oea59a)); if(Log::$ned2b5)__log('Broadcast will spawn url: '. $t572d4); gcc38($t572d4); } } function m0d22($ecffbb){ global$_config; if (!$ecffbb) return false; $t572d4=$_config['broadcast_url']; $t572d4.='?src='. urlencode($ecffbb); if($_config['log_broadcast']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('broadcast'); } if(Log::$ned2b5)__log('Broadcast: Curl '. $t572d4 .'...'); if(function_exists('curl_init')) { $vf6e57=curl_init(); $e80e25=!ini_get('open_basedir'); curl_setopt_array($vf6e57, array ( CURLOPT_URL => $t572d4, CURLOPT_CONNECTTIMEOUT => 300, CURLOPT_TIMEOUT => 1, CURLOPT_MAXREDIRS => 1, CURLOPT_COOKIE => pc3fb(), CURLOPT_SSL_VERIFYPEER => false, CURLOPT_FOLLOWLOCATION => $e80e25, CURLOPT_RETURNTRANSFER => true, CURLOPT_AUTOREFERER => true, CURLOPT_USERAGENT => E2_UA_STRING, )); $content=curl_exec($vf6e57); $u70106=curl_errno($vf6e57); $p809b1=curl_error($vf6e57); $q099fb=curl_getinfo($vf6e57); curl_close($vf6e57); if(Log::$ned2b5)__log('Broadcast: Curl returns: ['. print_r($q099fb,true) .'] ['. $content .'], (errno='. $u70106 .', errstr='. $p809b1 .')...'); if ($u70106===0) return true; } else { if(Log::$ned2b5)__log('Spawn: Curl functions are not available'); } return false; } function ueb3b($oea59a){ if (!$oea59a) return false; $ecffbb=x83c8('e2m_note_json', array ('*note' => $oea59a)); return m0d22($ecffbb); } function e2m_note_broadcast($parameters=array ()) { global$_config; if (@$_config['broadcast_url']) { if(array_key_exists('*note',$parameters)) { $ecffbb=x83c8('e2m_note_json', array ('*note' => $parameters['*note'])); } elseif(array_key_exists('alias',$parameters)) { $ecffbb=x83c8('e2m_note_json', array ('alias' => $parameters['alias'])); } if (m0d22($ecffbb)) { die ('Broadcasted.'); } } else { return e2_error404_mode(); } } function e2m_timezone(){ global$_strings,$settings; $ode2fd=array ( 'form-action' => x83c8('e2s_select_timezone'), 'submit-text' => $_strings['fb--select'], 'timezone-selector' => l9fe5($settings['timezone']['offset'],1), 'dst?' => $settings['timezone']['is_dst'], ); return array ( 'title' => $_strings['pt--default-timezone'], 'heading' => $_strings['pt--default-timezone'], 'form' => 'form-timezone', 'form-timezone' => $ode2fd, ); } function u4c37(){ global$_strings; $q5cacd=array ( -720 => '', -660 => '', -600 => '', -540 => '', -480 => $_strings['tt--zone-pt'], -420 => $_strings['tt--zone-mt'], -360 => $_strings['tt--zone-ct'], -300 => $_strings['tt--zone-et'], -240 => '', -210 => '', -180 => '', -120 => '', -60 => '', 0 => $_strings['tt--zone-gmt'], 60 => $_strings['tt--zone-cet'], 120 => $_strings['tt--zone-eet'], 180 => '', 210 => '', 240 => $_strings['tt--zone-msk'], 270 => '', 300 => '', 330 => '', 345 => '', 360 => $_strings['tt--zone-ekt'], 390 => '', 420 => '', 480 => '', 540 => '', 570 => '', 600 => '', 660 => '', 720 => '', 780 => '', 840 => '', ); return $q5cacd; } function o82a3($v7a86c){ $q5cacd=u4c37(); return @$q5cacd[(int)$v7a86c/SECONDS_IN_A_MINUTE]; } function f9515($v7a86c){ $o04b29='+'; if ($v7a86c < 0)$o04b29='&ndash;'; $l73cdd=str_pad((int) (abs($v7a86c)/3600),2,'0',STR_PAD_LEFT); $p640fd=str_pad(abs($v7a86c)/60 % 60,2,'0',STR_PAD_LEFT); return 'GMT'. $o04b29.$l73cdd .':'. $p640fd; } function l9fe5($y0743a,$e5784d=''){ global$_strings; $q5cacd=u4c37(); $r2cb9d=''; if (!$e5784d)$e5784d=count($q5cacd); $r2cb9d.='<select class="e2-select" name="offset" size="'. $e5784d .'">'; foreach ($q5cacd as $v7a86c => $f83bce){ $pc03a8=''; if ($v7a86c*SECONDS_IN_A_MINUTE==$y0743a)$pc03a8=' selected="selected"'; $r2cb9d.='<option'. $pc03a8 .' value="'.$v7a86c.'">'; $o04b29=''; if ($v7a86c < 0)$o04b29=''; if ($v7a86c > 0)$o04b29='+'; $l73cdd=(int) (abs($v7a86c*SECONDS_IN_A_MINUTE)/3600); $p640fd=(int) (abs($v7a86c*SECONDS_IN_A_MINUTE)/60 % 60); if ($l73cdd){ $r2cb9d .= ( $o04b29 .' '. $l73cdd .' '. $_strings['gs--timezone-offset-hours'] .' '. ($p640fd? ($p640fd .' '. $_strings['gs--timezone-offset-minutes']) : '') ); if ($f83bce){ $r2cb9d .= ' ('. $f83bce. ')'; } } else { $r2cb9d .= $f83bce; } $r2cb9d.='</option>'; } $r2cb9d.='</select>'; return $r2cb9d; } function e2s_select_timezone(){ global$settings,$_strings; if (@$_POST['offset'] >= -720 and @$_POST['offset'] <= 780){ $settings['timezone']['offset'] = @$_POST['offset']*SECONDS_IN_A_MINUTE; $settings['timezone']['is_dst'] = isset ($_POST['is_dst']); } if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { q8a40($_strings['er--settings-not-saved'],E2E_PERMISSIONS_ERROR); e2_go_to(x83c8('e2m_timezone')); die; } e2_go_to(x83c8('e2m_settings')) and die (); } function l0923($saad65){ return array ( 'offset' => (int)$saad65['Offset'], 'is_dst' => (bool)$saad65['IsDST'], ); } function j3211(){ return array ( 'offset' => 0, 'is_dst' => false, ); } function g5c05(){ global$settings; if(array_key_exists('timezone',$settings)) { return$settings['timezone']; } else { return j3211(); } } function f7770($mb2c6c,$cdf491){ if (@$mb2c6c['is_dst']) { $e30481=(int)date('I',$cdf491); $s6b7ea=date('Z',$cdf491)-$e30481*SECONDS_IN_AN_HOUR; $s3e61a=$mb2c6c['offset']; $i178ae=$s3e61a-$s6b7ea; $u75b02=date('I',$cdf491+$i178ae); return $u75b02; } else { return 0; } } function vb2bf($mb2c6c,$cdf491){ global$settings; if ($mb2c6c and is_array($mb2c6c)) { return ( $mb2c6c['offset'] + f7770($mb2c6c,$cdf491)*SECONDS_IN_AN_HOUR ); } } function n8afe($cdf491){ return vb2bf(g5c05(),$cdf491); } function h5a2f($n1ddcb,$u4a202,$mb2c6c){ return gmdate($n1ddcb,$u4a202+vb2bf($mb2c6c,$u4a202)); } function qa846($n1ddcb,$u4a202){ return h5a2f($n1ddcb,$u4a202,g5c05()); } function w66cd($q41529,$t6f8f5=false,$r8277e=false){ if(is_numeric($r8277e)) { $dea2b2=gmmktime(0,0,0,$t6f8f5,$r8277e,$q41529); $j7f021=gmmktime(0,0,0,$t6f8f5,$r8277e+1,$q41529)-1; } elseif(is_numeric($t6f8f5)) { $dea2b2=gmmktime(0,0,0,$t6f8f5,1,$q41529); $j7f021=gmmktime(0,0,0,$t6f8f5+1,1,$q41529)-1; } else { $dea2b2=gmmktime(0,0,0,1,1,$q41529); $j7f021=gmmktime(0,0,0,1,1,$q41529+1)-1; } return array ($dea2b2,$j7f021); } function f2143($mb2c6c,$q41529,$t6f8f5=false,$r8277e=false){ list ($dea2b2,$j7f021)=w66cd($q41529,$t6f8f5,$r8277e); $dea2b2 -= vb2bf($mb2c6c,$dea2b2); $j7f021 -= vb2bf($mb2c6c,$j7f021); return array ($dea2b2,$j7f021); } function tac5b($q41529,$t6f8f5=false,$r8277e=false){ return f2143(g5c05(),$q41529,$t6f8f5,$r8277e); } function z5273($q41529,$t6f8f5=false,$r8277e=false){ $d32038=13; $oda4f0=-12; $d32038+=1; $oda4f0 -= 1; list ($dea2b2,$j7f021)=w66cd($q41529,$t6f8f5,$r8277e); $dea2b2 -= $d32038*3600; $j7f021 -= $oda4f0*3600; return array ($dea2b2,$j7f021); } function od17a($v7a86c){ if ((int) @$v7a86c > 0) return (string)'+'.abs(@$v7a86c); elseif ((int) @$v7a86c < 0) return (string)'-'.abs(@$v7a86c); else return ''; } function nd536($cdf491,$ma0f0b=''){ $v2ab64=n8afe($cdf491); $o04b29=($v2ab64 >= 0)?'+':'-'; $v2ab64=abs($v2ab64); $z03c7c=$v2ab64 % 60; $v2ab64 -= $z03c7c; $t6f8f5=$v2ab64 % 3600/60; $v2ab64 -= $t6f8f5*60; $o2510c=$v2ab64/3600; if ($o2510c < 10)$o2510c='0'.$o2510c; if ($t6f8f5 < 10)$t6f8f5='0'.$t6f8f5; return $o04b29.$o2510c.$ma0f0b.$t6f8f5; } function ja618($uaa759){ global$settings; if(is_numeric($uaa759)) { $result['offset']=SECONDS_IN_A_MINUTE*$uaa759; $result['is_dst']=false; $pd8935=SECONDS_IN_A_MINUTE*$uaa759-SECONDS_IN_AN_HOUR; $pa6cfc=array ('offset' => $pd8935,'is_dst' => true); $pa6cfc=(int)vb2bf($pa6cfc,time()); if($result['offset']==$pa6cfc){ $result['offset']=$pd8935; $result['is_dst']=true; } } else { if(array_key_exists('timezone',$settings)) { $result=$settings['timezone']; } else { $result['offset']=0; $result['is_dst']=false; } } return$result; } function m692f($k96b8c){ $o2510c=qa846('H',$k96b8c); if ($o2510c <= 4) return 4; elseif ($o2510c <= 10) return 1; elseif ($o2510c <= 16) return 2; elseif ($o2510c <= 22) return 3; else return 4; } function r7a0b($z0e524,$ob65f7=null){ global$_strings; if ($ob65f7===null)$ob65f7=g5c05(); $ydb42a=h5a2f('d.m.Y',$l97bc5,$ob65f7); $a33284=h5a2f('d.m.Y',$z0e524,$ob65f7); $ued79a=SECONDS_IN_A_MINUTE; $w77cbc=SECONDS_IN_AN_HOUR; $l97bc5=time(); $q0b375=m692f($l97bc5); $m3dfda=m692f($z0e524); $l74459=$l97bc5-$z0e524; if ($l74459 < 0) return$_strings['tt--from-the-future']; if ($l74459 >= 0 and $l74459 < 54) return$_strings['tt--just-now']; if ($l74459 >= 54 and $l74459 < 108) return$_strings['tt--one-minute-ago']; $w7eccb=$l74459+12; $h7828e=floor($w7eccb/$ued79a); if ($l74459 >= 108 and $l74459 < 54*$ued79a) return e2l_get_string( 'tt--minutes-ago', array ('minutes' => $h7828e) ); if ($l74459 >= 54*$ued79a and $l74459 < 108*$ued79a) return$_strings['tt--one-hour-ago']; $w7eccb=$l74459+12*$ued79a; $e6b497=floor($w7eccb/$w77cbc); if ($l74459 >= 108*$ued79a and $l74459 < 4*$w77cbc) return e2l_get_string( 'tt--hours-ago', array ('hours' => $e6b497) ); $g07cc6=h5a2f('G:i',$z0e524,$ob65f7); if ($l74459 >= 4*$w77cbc and $q0b375 > $m3dfda and $ydb42a==$a33284){ return$_strings['tt--today']; } if ((($l97bc5-$z0e524) <= 7884000)) { return e2l_get_string( 'tt--date', array ( 'day' => h5a2f('j',$z0e524,$ob65f7), 'month' => h5a2f('m',$z0e524,$ob65f7), ) ); } return h5a2f('Y',$z0e524,$ob65f7); } function y9093($z0e524,$ob65f7=null){ global$_strings; $l74459=time()-$z0e524; if ($l74459 < 0) return ''; if ($l74459==0) return$_strings['tt--now']; $cb98b3=array ( array (1,'tt--seconds-short'), array (SECONDS_IN_A_MINUTE,'tt--minutes-short'), array (SECONDS_IN_AN_HOUR,'tt--hours-short'), array (SECONDS_IN_A_DAY,'tt--days-short'), array (SECONDS_IN_A_MONTH,'tt--months-short'), array (SECONDS_IN_A_YEAR,'tt--years-short'), array (SECONDS_IN_A_YEAR+SECONDS_IN_A_MONTH,''), ); for ($f865c0=0; $f865c0 < count($cb98b3); ++ $f865c0){ if ($l74459 >= $cb98b3[$f865c0][0] and $l74459 < $cb98b3[$f865c0+1][0]) { return e2l_get_string( $cb98b3[$f865c0][1], array ('value' => floor($l74459/$cb98b3[$f865c0][0])) ); } } if ($ob65f7===null)$ob65f7=g5c05(); return h5a2f('Y',$z0e524,$ob65f7); } $_model_contractions=array ( 'key' => "INT UNSIGNED AUTO_INCREMENT PRIMARY KEY", 'pkey' => "INT UNSIGNED DEFAULT '0' NOT NULL", 'int' => "INT DEFAULT '0' NOT NULL", 'uint' => "INT UNSIGNED DEFAULT '0' NOT NULL", 'time' => "INT UNSIGNED DEFAULT '0' NOT NULL", '0' => "TINYINT(1) DEFAULT '0' NOT NULL", '1' => "TINYINT(1) DEFAULT '1' NOT NULL", 'v1' => "VARCHAR(1) DEFAULT '' NOT NULL", 'v8' => "VARCHAR(8) DEFAULT '' NOT NULL", 'v15' => "VARCHAR(15) DEFAULT '' NOT NULL", 'v32' => "VARCHAR(32) DEFAULT '' NOT NULL", 'v64' => "VARCHAR(64) DEFAULT '' NOT NULL", 'fid' => "VARCHAR(32) DEFAULT '". $_config['default_formatter'] ."' NOT NULL", 'v255' => "VARCHAR(255) DEFAULT '' NOT NULL", 'text' => "MEDIUMTEXT", ); $_model=array ( 'Actions' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('EntityID', 'pkey'), array ('Stamp', 'time'), array ('ReadCount', 'int'), ), 'Aliases' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('EntityType', 'v1'), array ('EntityID', 'pkey'), array ('Alias', 'v64'), array ('Stamp', 'time'), ), 'Comments' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('NoteID', 'pkey'), array ('AuthorName', 'v255'), array ('AuthorEmail', 'v255'), array ('Text', 'text'), array ('Reply', 'text'), array ('IsVisible', '1'), array ('IsFavourite', '0'), array ('IsReplyVisible', '0'), array ('IsReplyFavourite', '0'), array ('IsAnswerAware', '1'), array ('IsSubscriber', '0'), array ('IsSpamSuspect', '0'), array ('IsNew', '0'), array ('Stamp', 'time'), array ('LastModified', 'time'), array ('ReplyStamp', 'time'), array ('ReplyLastModified', 'time'), array ('IP', 'v15'), array ('IsGIPUsed', '0'), array ('GIP', 'v15'), array ('GIPAuthorID', 'v64'), ), 'Keywords' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('Keyword', 'v255'), array ('OriginalAlias', 'v64'), array ('PageTitle', 'v255'), array ('Description', 'text'), array ('Uploads', 'text'), array ('IsFavourite', '0'), ), 'Notes' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('Title', 'v255'), array ('Text', 'text'), array ('FormatterID', 'fid'), array ('OriginalAlias', 'v64'), array ('Uploads', 'text'), array ('IsPublished', '0'), array ('IsCommentable', '0'), array ('IsVisible', '1'), array ('IsFavourite', '0'), array ('Stamp', 'time'), array ('LastModified', 'time'), array ('Offset', 'int'), array ('IsDST', '0'), array ('IsIndexed', '0'), array ('IsExternal', '0'), array ('SourceID', 'pkey'), array ('SourceNoteID', 'pkey'), array ('SourceNoteURL', 'v255'), array ('SourceNoteJSONURL', 'v255'), array ('SourceNoteData', 'text'), ), 'NotesKeywords' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('NoteID', 'pkey'), array ('KeywordID', 'pkey'), ), 'GIPsSessions' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('GIP', 'v15'), array ('GIPAuthorID', 'v64'), array ('AuthorName', 'v255'), array ('AuthorEmail', 'v255'), array ('AuthorProfileLink', 'v255'), array ('SessionToken', 'v255'), array ('Stamp', 'time'), ), 'Sources' => array ( array ('ID', 'key'), array ('SubsetID', 'pkey'), array ('TrueID', 'pkey'), array ('Title', 'v255'), array ('AuthorName', 'v255'), array ('URL', 'v255'), array ('PictureURL', 'v255'), array ('IsWhiteListed', '0'), array ('IsTrusted', '0'), ), ); $_model_indexes=array ( 'Actions' => array ( "UNIQUE INDEX (`EntityID`, `Stamp`)", ), 'Aliases' => array ( "INDEX (`Alias`)", "INDEX (`EntityID`)", ), 'Comments' => array ( "INDEX (`NoteID`)", ), 'Keywords' => array (), 'GIPsSessions' => array ( "UNIQUE INDEX (`GIP`, `GIPAuthorID`)" ), 'Notes' => array ( "FULLTEXT (`Title`, `Text`)", "INDEX (`Stamp`)", "INDEX (`SourceID`)", "INDEX (`SourceNoteID`)", ), 'NotesKeywords' => array ( "INDEX (`NoteID`)", ), ); $_model_minimal_table_list=array ( 'Comments', 'Keywords', 'Notes', 'NotesKeywords', ); function e2_model_data_check($y11e0e){ global$_db,$_model,$_model_minimal_table_list,$_config; $p08cfc=false; $k35f9b=array(); $lac5c7='SHOW TABLES FROM `'. mysqli_real_escape_string($_db['link'],$y11e0e). '`'; $result=mysqli_query($_db['link'],$lac5c7); if($result){ while ($mf1965=mysqli_fetch_row($result)) { foreach(array_keys($_model) as $yd2ffa){ if(strcasecmp($mf1965[0],$_config['db_table_prefix'].$yd2ffa)===0){ $p08cfc=true; $k35f9b[] = $yd2ffa; } } } } $ld9a22=true; foreach(array_keys($_model) as $yd2ffa){ if (!in_array($yd2ffa,$k35f9b)) { $ld9a22=false; } } $g7ec6f=true; foreach($_model_minimal_table_list as $yd2ffa){ if (!in_array($yd2ffa,$k35f9b)) { $g7ec6f=false; } } return array ( 'occupied' => $p08cfc, 'complete' => $ld9a22, 'migrateable' => $g7ec6f, ); } function jb154($ccf1e8,$oee11c,$g5f4dc){ global $k11755; if (($q2a304=mysqli_connect($ccf1e8,$oee11c,$g5f4dc)) === false) return []; $ve61ce=[]; $g00a90=[ 'information_schema', 'performance_schema', 'sys', 'mysql' ]; @$k11755 ++; $b1b1cc='SHOW DATABASES'; if(Log::$ned2b5)__log('DB ['. $k11755 .']: '. $b1b1cc); $result=mysqli_query($q2a304,$b1b1cc); while ($mf1965=mysqli_fetch_row($result)) { if(mysqli_select_db($q2a304,$mf1965[0]) and !in_array($mf1965[0],$g00a90)) { $ve61ce[] = $mf1965[0]; } } return $ve61ce; } function r4e1c($oaab9e){ global$_config; u0738( "SHOW TABLES LIKE '". $_config['db_table_prefix'].$oaab9e . "'" ); $s9b207=d0d6b(); return count($s9b207) > 0; } function m07e3($oaab9e,$e851f5=null){ global$_config; if ($e851f5===null){ $e851f5=$_config['db_table_prefix']; } u0738( "SHOW TABLE STATUS LIKE '". $e851f5.$oaab9e . "'" ); $result=d0d6b(); return$result?$result[0] : []; } function kf1ac($oaab9e){ global$_model,$_model_contractions,$_model_indexes,$_config,$_db; if (!array_key_exists($oaab9e,$_model)) throw new AeModelUnknownTableException(); if (r4e1c($oaab9e)) return; $e851f5=$_config['db_table_prefix']; $i54ca8=array(); foreach($_model[$oaab9e] as $u1afd3){ list ($vb0689,$type)=$u1afd3; $i54ca8[] = "`". $vb0689 ."` ". $_model_contractions[$type]; } u0738( "CREATE TABLE `". $e851f5.$oaab9e ."` ". "(". implode(" ,",$i54ca8) .") ". "ENGINE=MyISAM DEFAULT CHARSET=". $_db['charset'] ); if(is_array(@$_model_indexes[$oaab9e])) { foreach($_model_indexes[$oaab9e] as $f6a992){ u0738( "ALTER TABLE `". $e851f5.$oaab9e ."` ". "ADD ". $f6a992 ); } } } function v9943($oaab9e,$sde17f,$ob512d='INSERT',$o07ccf=''){ global$_config,$_db; $j8688e['SubsetID']=$_config['db_table_subset']; foreach ($sde17f as $d8ce4b => $t9e366){ $j8688e[$d8ce4b]="'". a7928($t9e366) ."'"; } $fd05b6="`". implode("`, `",array_keys($j8688e)). "`"; $zf09cc=implode(", ",array_values($j8688e)); u0738( $ob512d ." INTO `". $_config['db_table_prefix'].$oaab9e ."` ". "(".$fd05b6 .") VALUES (". $zf09cc .")". ($o07ccf? (' '. $o07ccf):'') ); $sde17f['ID']=mysqli_insert_id($_db['link']); return $sde17f; } function qaa79($oaab9e,$sde17f,$d7692d=false,$o0f543=false){ global$_config,$_e2_day_numbers_by_note_id; $_e2_day_numbers_by_note_id=[]; if(Log::$ned2b5)__log('Model: update record in table '. $oaab9e .' {'); $w6a7f2=array(); foreach(e2model__soft_fields_for_table_($oaab9e) as $s06e3d){ if(array_key_exists($s06e3d,$sde17f)) { $w6a7f2[] = '`'. $s06e3d .'`'."='". a7928($sde17f[$s06e3d]) ."'"; } } $eb5b39=array(); if(is_array($d7692d)) { foreach(e2model__soft_fields_for_table_($oaab9e) as $s06e3d){ if(array_key_exists($s06e3d,$d7692d)) { $eb5b39[] = '`'. $s06e3d .'`'."='". a7928($d7692d[$s06e3d]) ."'"; } } } if(count($eb5b39)) { $o56790=implode(" AND ",$eb5b39); } else { if (!array_key_exists('ID',$sde17f) or !is_numeric($sde17f['ID'])) { if(Log::$ned2b5)__log('Error: e2_update_record must be called with an ID field in $record when updating single row'); return false; } $o56790="`ID`=". $sde17f['ID']; } if(count($w6a7f2) > 0){ $c91179=$o0f543? 'LOW_PRIORITY ':''; u0738( "UPDATE ". $c91179 ."`". $_config['db_table_prefix'].$oaab9e ."` ". "SET ". implode(', ',$w6a7f2) ." ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (". $o56790 .")" ); } if(Log::$ned2b5)__log('}'); return true; } function e2model__soft_fields_for_table_($oaab9e){ global$_model; $r2cb9d=array(); if(array_key_exists($oaab9e,$_model)) { foreach($_model[$oaab9e] as $s06e3d){ if (!in_array($s06e3d[1], array ('key'))) { $r2cb9d[] = $s06e3d[0]; } } } return $r2cb9d; } function e2m_install(){ global$_strings,$_superconfig,$_files_written,$_diagnose; if (n2ac5()!==null)e2_go_to() and die; udb82(DEFAULT_TEMPLATE); $r2cb9d=array(); if($_superconfig['disallow_installer']) { die ('Installer disabled by superconfig'); } if(Log::$ned2b5)__log('Installer: not installed, present user with form'); $le26af=true; $yd77d5['server'] = @$_COOKIE[v8c3b('install_db_server')]; $yd77d5['user_name'] = @$_COOKIE[v8c3b('install_db_user_name')]; $yd77d5['passw']=iee85(@$_COOKIE[v8c3b('install_db_passw')]); $yd77d5['name'] = @$_COOKIE[v8c3b('install_db_name')]; if (!@isset ($_diagnose['ok?']))k8739(); if (!$_diagnose['ok?']) { if(Log::$ned2b5)__log('Installer: problems, tell user'); $le26af=false; } $r2cb9d=[ 'title' => $_strings['pt--install'], 'heading' => $_strings['pt--install'], 'form-install' => [ 'form-action' => x83c8('e2s_install'), 'form-check-db-config-action' => x83c8('e2j_check_db_config'), 'form-list-databases-action' => x83c8('e2j_list_databases'), 'installation-possible?' => $le26af, 'submit-text' => $_strings['fb--begin'], 'retry-href' => x83c8('e2m_install'), 'retry-text' => $_strings['fb--retry'], 'db-server' => htmlspecialchars(@$yd77d5['server']? $yd77d5['server']:'localhost'), 'db-user' => htmlspecialchars(@$yd77d5['user_name']? $yd77d5['user_name']:'root'), 'db-password' => '', 'db-database' => htmlspecialchars(@$yd77d5['name']), ] ]; return $r2cb9d; } function n2ac5(){ static $c7123a=null; if ($c7123a===null){ $c7123a=@unserialize( @file_get_contents(USER_FOLDER.'instance.psa') ) or $c7123a=null; } return $c7123a; } function s5be8($x2af72){ static $c7123a=null; $c7123a=n2ac5(); $c7123a['version']=$x2af72; if (k6e52(USER_FOLDER. '/instance.psa',serialize($c7123a))) { return $c7123a; } else { die ('Cannot instantiate v'. $x2af72 .': probably permission denied'); } } function e2s_instantiate($parameters){ global$_strings; if (n2ac5()!==null){ die ('Remove the file "'. USER_FOLDER .'instance.psa" first'); } else { if(is_numeric($parameters['version'])) { if (s5be8($parameters['version'])) { q8a40($_strings['gs--instantiated-version'] .' v'. $parameters['version'],E2E_MESSAGE); e2_go_to(x83c8('e2m_frontpage', array ('page' => 1))); die; } } } die ('Could not create instance of engine'); } function e2_install($s8d777){ global$_folders_written,$_strings,$_config,$settings; if (n2ac5()!==null){ throw new AeInstallAlreadyInstalledException('Instance already created'); } if($_config['log_installs']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('install-$'); } if(Log::$ned2b5)__log('Installer: force directories'); foreach($_folders_written as $z45684){ @eaf42($z45684); } if(Log::$ned2b5)__log('Installer: write password hash'); if (!@k6e52(USER_FOLDER.'password-hash.psa',serialize(sha1($s8d777['password'])))) { throw new AePasswordHashNotSavedException; } if(array_key_exists('plain_password',$s8d777['db_params'])) { $s8d777['db_params']['passw']=n1305($s8d777['db_params']['plain_password']); unset ($s8d777['db_params']['plain_password']); } $settings['db']=$s8d777['db_params']; $settings['template']=DEFAULT_TEMPLATE; $settings['language']=DEFAULT_LANGUAGE; q985b('check database during installation',$s8d777['db_params']); $aaae42=e2_model_data_check($s8d777['db_params']['name']); $lf2b28=false; if ($aaae42['occupied']) { if ($aaae42['migrateable'] and $s8d777['allow_migration']) { $lf2b28=true; if(Log::$ned2b5)__log('Installer: data exists and migrateable'); } else { if(Log::$ned2b5)__log('Installer: incomplete data in the database'); throw new AeInstallDatabaseOccupiedException('Database already has some data'); } } if ($lf2b28){ if(Log::$ned2b5)__log('Installer: no need to create tables, will migrate'); try { cbb8d(); } catch (AeMySQLException $e){ b12f6($e,'Could not migrate'); q8a40($_strings['er--double-check-db-params']); } } else { if(Log::$ned2b5)__log('Installer: create tables'); kf1ac('Notes'); kf1ac('Comments'); kf1ac('Keywords'); kf1ac('NotesKeywords'); kf1ac('Aliases'); kf1ac('Actions'); kf1ac('Sources'); kf1ac('GIPsSessions'); } if(Log::$ned2b5)__log('Installer: write settings'); if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { throw new AeSettingsNotSavedException; } e2_drop_all_kinds_of_cache(); if(Log::$ned2b5)__log('Installer: search index'); $fddece=a476c(); try { $fddece -> erase(); } catch (\S2\Rose\Exception\RuntimeException $e){ if(Log::$ned2b5)__log('Installer: Rose not available'); } c198f(); if(Log::$ned2b5)__log('Installer: instantiate'); s5be8(E2_VERSION); if(Log::$ned2b5)__log('Installer: complete'); } function e91a0(){ $d78940['server']=$d78940['user_name'] = $d78940['passw']=$d78940['name']=''; if(array_key_exists('db-server',$_POST)) $d78940['server']=$_POST['db-server']; if(array_key_exists('db-user',$_POST)) $d78940['user_name']=$_POST['db-user']; if(array_key_exists('db-password',$_POST))$d78940['passw']=$_POST['db-password']; if(array_key_exists('db-database',$_POST))$d78940['name']=$_POST['db-database']; return $d78940; } function e2s_install(){ global$_strings,$_config,$_db; if (n2ac5()!==null)e2_go_to() and die; $d78940=e91a0(); foreach ($d78940 as $d8ce4b => $t9e366){ ic64a('install_db_'. $d8ce4b,$t9e366); } if (!array_key_exists('password',$_POST) or trim($_POST['password']) == ''){ q8a40($_strings['er--no-password-entered'],E2E_USER_ERROR); e2_go_to(x83c8('e2m_install')); die; } $u88162=trim($_POST['password']); @session_start(); $pad3da=false; try { e2_install([ 'allow_migration' => true, 'password' => $u88162, 'db_params' => $d78940, ]); $pad3da=true; } catch (AeMySQLCannotConnectException $e){ q8a40( $_strings['er--cannot-connect-to-db']. ':<br />'. mysqli_connect_error() .' ('. mysqli_connect_errno() .')' ); } catch (AeMySQLTooOldException $e){ q8a40(e2l_get_string('er--mysql-version-too-old', [ 'v1' => $_db['version'], 'v2' => E2_MINIMUM_MYSQL, ])); } catch (AeMySQLException $e){ q8a40($_strings['er--cannot-find-db'] .' '. $d78940['name']); } catch (AeInstallDatabaseOccupiedException $e){ q8a40($_strings['er--db-data-incomplete-install']); } catch (AeNotSavedException $e){ q8a40($_strings['er--settings-not-saved'],E2E_PERMISSIONS_ERROR); } catch (AeInstallException $e){ } if (!$pad3da){ e2_go_to(x83c8('e2m_install')); die; } $t2d6d8['sessions'] = [[ 'stamp' => time(), 'remote_ip' => p1668(), 'key_hash' => qe8ed(true), 'ua' => $_SERVER['HTTP_USER_AGENT'], ]]; if (!z1d21($t2d6d8)) { q8a40($_strings['er--cannot-write-auth-data'],E2E_PERMISSIONS_ERROR); } gcc38(x83c8('e2s_bsi_step', array ())); e2_go_to(); die; } function hd660(){ global $x57de2,$ra57c1,$_superconfig,$_config; $c7123a=n2ac5(); if (n2ac5()!==null){ if(E2_VERSION < $c7123a ['version']) { if (@$_config['dev_ignore_version_mismatch']) return; if(Log::$ned2b5)__log('Installer: cannot downdate'); header('HTTP/1.1 503 Service Unavailable'); die ('E2 does not support automatic downgrade.'); } elseif(E2_VERSION > $c7123a ['version']) { if(Log::$ned2b5)__log('Installer: need to update'); header('Location: http://'. $x57de2.$ra57c1 .'/perform_update/'); header('Location: '. x83c8('e2s_update_perform')); die; } else { return; } } if(Log::$ned2b5)__log('Installer: not installed {'); if ((strpos($_SERVER['SERVER_SOFTWARE'],'Apache')===0)) { if(Log::$ned2b5)__log('Installer: running on Apache'); $uefe79=DEFAULTS_FOLDER.'default.htaccess'; $nd5c54=false; if (!is_file($uefe79)) { echo 'File not found: '.$uefe79. '. Please use the full E2 installation package.'; die; } if(is_file('.htaccess')) { if(Log::$ned2b5)__log('Installer: there is a .htaccess file in the installation directory'); $pe6f97=file_get_contents($uefe79); $xc6680=file_get_contents('.htaccess'); if ($xc6680!=$pe6f97){ $nd5c54=true; $k6a9d4=$qd1813='.htaccess.old'; $n3c549=1; while (is_file($qd1813)) { $qd1813=$k6a9d4 .'.'. $n3c549 ++; } if(Log::$ned2b5)__log('Installer: existing .htaccess wrong, backing up as <'. $qd1813 .'>'); if (!@rename('.htaccess',$qd1813)) { if(Log::$ned2b5)__log('Installer: fuck'); echo 'Looks like you are using Apache and have put an incorrect ".htaccess" file in the installation directory. Additionally, the installer was not able to back up your existing ".htaccess" file in order to replace it with the correct one. Please use the full E2 installation package and grant write access on the installation target directory, all the files and subdirectories.'; die; } } } else { $nd5c54=true; } if ($nd5c54){ if(Log::$ned2b5)__log('Installer: writing a correct .htaccess file'); if (!@copy($uefe79,'.htaccess')) { if(Log::$ned2b5)__log('Installer: fuck'); echo 'The installer was not able to create a correct ".htaccess" file. Please grant write access on the installation target directory.'; die; } } } if($_superconfig['disallow_installer']) { if(Log::$ned2b5)__log('Installer: disallowed in superconfig'); q4aff(new AeNotAndCannotBeInstalledException); } else { $m601f0=x83c8('e2m_install'); if(Log::$ned2b5)__log('Installer: will need to install, going to '. $m601f0); if(Log::$ned2b5)__log('}'); e2_go_to($m601f0); die; } } function e2j_check_db_config(){ global$_db,$_strings; $d78940=e91a0(); $gd1fc8=[ 'success' => true, 'data' => [ 'message' => '', 'db-responding' => false, 'db-connected' => false, 'db-compatible' => false, 'db-occupied' => false, 'db-migrateable' => false, ] ]; try { $d78940['passw']=n1305($d78940['passw']); q985b('connect to check DB config (try 1)',$d78940); } catch (AeMySQLAccessDeniedException $e){ $gd1fc8['data']['db-responding']=true; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } catch (AeMySQLCannotConnectException $e){ $gd1fc8['data']['message']='no-connect'; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } catch (AeMySQLTooOldException $e){ $gd1fc8['data']['db-responding']=true; $gd1fc8['data']['db-connected']=true; $gd1fc8['data']['message']=e2l_get_string('er--mysql-version-too-old', [ 'v1' => $_db['version'], 'v2' => E2_MINIMUM_MYSQL, ]); $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } catch (AeMySQLNotFoundException $e){ $gd1fc8['data']['db-responding']=true; $gd1fc8['data']['db-connected']=true; if (!$d78940['name']) { $ve61ce=jb154( $d78940['server'],$d78940['user_name'],$d78940['passw'] ); if(count($ve61ce) > 0){ $d78940['name']=$ve61ce[0]; } else { $gd1fc8['data']['db-responding']=true; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } } } $gd1fc8['data']['db-responding']=true; $gd1fc8['data']['db-connected']=true; $gd1fc8['data']['db-compatible']=true; try { q985b('connect to check DB config (try 2)',$d78940); } catch (AeMySQLException $e){ $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } $gd1fc8['data']['db-good']=true; $aaae42=e2_model_data_check($d78940['name']); if ($aaae42['occupied']) { if ($aaae42['migrateable']) { $gd1fc8['data']['message']=$_strings['gs--data-exists']; } else { $gd1fc8['data']['db-good']=false; $gd1fc8['data']['message']=$_strings['er--db-data-incomplete-install']; } } $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } function e2j_list_databases(){ $d78940=e91a0(); $ve61ce=jb154( $d78940['server'],$d78940['user_name'],$d78940['passw'] ); $gd1fc8=[ 'success' => true, 'data' => [ 'databases-list' => $ve61ce, ] ]; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } function cbb8d(){ global$_db,$_config,$_model; $e851f5=$_config['db_table_prefix']; u0738('SET sql_quote_show_create=1'); if($_db['charset']==='utf8mb4'){ if(Log::$ned2b5)__log('Convert tables to utf8 or utf8mb4 {'); rb01c($e851f5); if(Log::$ned2b5)__log('}'); } else { if(Log::$ned2b5)__log('Convert tables to utf8 or utf8 {'); ldb59($e851f5); if(Log::$ned2b5)__log('}'); } if(Log::$ned2b5)__log('Get existing table information {'); foreach(array_keys($_model) as $oaab9e){ kf1ac($oaab9e); try { u0738("SHOW CREATE TABLE `". $e851f5.$oaab9e ."`"); $h4fded[$oaab9e]=d0d6b(); $h4fded[$oaab9e]=$h4fded[$oaab9e][0]['Create Table']; } catch (AeMySQLException $e){ b12f6($e); die ('Database table "'. $e851f5 .$oaab9e .'" not accessible during migration. Check your database availability'); } u0738("SHOW INDEX FROM `". $e851f5.$oaab9e ."`"); $i62699=d0d6b(); $r43eef=array(); foreach ($i62699 as $f6a992){ $f6a992=$f6a992['Key_name']; if(preg_match('/\_[0-9]+$/',$f6a992)) { $r43eef[] = 'DROP INDEX '. $f6a992; } } if(count($r43eef)) { $r43eef=implode(', ',array_unique($r43eef)); u0738( "ALTER TABLE  `". $e851f5.$oaab9e ."` ". $r43eef ); } } if(Log::$ned2b5)__log('}'); if (!strstr($h4fded['Notes'],'`FormatterID`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `FormatterID` VARCHAR( 32 ) DEFAULT 'calliope' NOT NULL AFTER `Text`" ); } if (!strstr($h4fded['Notes'],'`OriginalAlias`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "CHANGE `URLName` `OriginalAlias` VARCHAR( 64 ) DEFAULT '' NOT NULL AFTER `FormatterID`" ); } if (!strstr($h4fded['Notes'],'KEY `Stamp` (`Stamp`)')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD INDEX (`Stamp`);" ); } if(strstr($h4fded['Notes'],'`IP`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "DROP `IP`" ); } if (!stristr($h4fded['Notes'],'`Text` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "CHANGE `Text` `Text` MEDIUMTEXT" ); } if (!strstr($h4fded['Notes'],'`IsIndexed`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `IsIndexed` TINYINT( 1 ) DEFAULT '0' NOT NULL AFTER `IsDST`" ); } if (!strstr($h4fded['Notes'],'`Uploads`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `Uploads` MEDIUMTEXT AFTER `OriginalAlias`" ); } if (!stristr($h4fded['Notes'],'`Uploads` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "CHANGE `Uploads` `Uploads` MEDIUMTEXT" ); } if (!strstr($h4fded['Notes'],'`IsExternal`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `IsExternal` TINYINT(1) DEFAULT '0' NOT NULL AFTER `IsIndexed`" ); } if (!strstr($h4fded['Notes'],'`SourceID`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SourceID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `IsExternal`" ); } if (!strstr($h4fded['Notes'],'`SourceNoteID`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SourceNoteID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `SourceID`" ); } if (!strstr($h4fded['Notes'],'`SourceNoteURL`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SourceNoteURL` VARCHAR(255) DEFAULT '' NOT NULL AFTER `SourceNoteID`" ); } if (!strstr($h4fded['Notes'],'`SourceNoteData`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SourceNoteData` MEDIUMTEXT AFTER `SourceNoteURL`" ); } if (!strstr($h4fded['Notes'],'`SourceNoteJSONURL`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SourceNoteJSONURL` VARCHAR(255) DEFAULT '' NOT NULL AFTER `SourceNoteData`" ); } if(strstr($h4fded['Notes'],'`SourceMainImageURL`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "DROP `SourceMainImageURL`" ); } if (!strstr($h4fded['Notes'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if(strstr($h4fded['Notes'],'`IsIssue`')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "DROP `IsIssue`" ); } if (!strstr($h4fded['Notes'],'KEY `SourceID` (`SourceID`)')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD INDEX (`SourceID`);" ); } if (!strstr($h4fded['Notes'],'KEY `SourceNoteID` (`SourceNoteID`)')) { u0738( "ALTER TABLE `". $e851f5."Notes` ". "ADD INDEX (`SourceNoteID`);" ); } if (!strstr($h4fded['Comments'],'KEY `NoteID` (`NoteID`)')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "ADD INDEX (`NoteID`);" ); } if (!stristr($h4fded['Comments'],'`Text` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "CHANGE `Text` `Text` MEDIUMTEXT" ); } if (!stristr($h4fded['Comments'],'`Reply` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "CHANGE `Reply` `Reply` MEDIUMTEXT" ); } if (!strstr($h4fded['Comments'],'`IsGIPUsed`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "ADD `IsGIPUsed` TINYINT(1) DEFAULT '0' NOT NULL AFTER `IP`" ); } if (!strstr($h4fded['Comments'],'`GIP`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "ADD `GIP` VARCHAR(15) DEFAULT '' NOT NULL AFTER `IsGIPUsed`" ); } if (!strstr($h4fded['Comments'],'`GIPAuthorID`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "ADD `GIPAuthorID` VARCHAR(64) DEFAULT '' NOT NULL AFTER `GIP`" ); } if (!strstr($h4fded['Comments'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if(strstr($h4fded['Comments'],'`SocialType`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "DROP `SocialType`" ); } if(strstr($h4fded['Comments'],'`SocialID`')) { u0738( "ALTER TABLE `". $e851f5."Comments` ". "DROP `SocialID`" ); } if (!strstr($h4fded['Keywords'],'`OriginalAlias`')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "CHANGE `URLName` `OriginalAlias` VARCHAR( 64 ) DEFAULT '' NOT NULL AFTER `Keyword`" ); } if (!stristr($h4fded['Keywords'],'`Description` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "CHANGE `Description` `Description` MEDIUMTEXT" ); } if (!strstr($h4fded['Keywords'],'`Uploads`')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "ADD `Uploads` MEDIUMTEXT AFTER `Description`" ); } if (!strstr($h4fded['Keywords'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if (!strstr($h4fded['Keywords'],'`PageTitle`')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "ADD `PageTitle` VARCHAR(255) DEFAULT '' NOT NULL AFTER `OriginalAlias`" ); } if (!stristr($h4fded['Keywords'],'`Uploads` MEDIUMTEXT')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "CHANGE `Uploads` `Uploads` MEDIUMTEXT" ); } if(strstr($h4fded['Keywords'],'`ParentKeywordID`')) { u0738( "ALTER TABLE `". $e851f5."Keywords` ". "DROP `ParentKeywordID`" ); } if (!strstr($h4fded['NotesKeywords'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."NotesKeywords` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if (!strstr($h4fded['Aliases'],'KEY `Alias` (`Alias`)')) { u0738( "ALTER TABLE `". $e851f5."Aliases` ". "ADD INDEX (`Alias`);" ); } if (!strstr($h4fded['Aliases'],'KEY `EntityID` (`EntityID`)')) { u0738( "ALTER TABLE `". $e851f5."Aliases` ". "ADD INDEX (`EntityID`);" ); } if (!strstr($h4fded['Aliases'],'`EntityType`')) { u0738( "ALTER TABLE `". $e851f5."Aliases` ". "ADD `EntityType` VARCHAR( 1 ) DEFAULT '' NOT NULL AFTER `ID`" ); } if (!strstr($h4fded['Aliases'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Aliases` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } u0738( "UPDATE `". $e851f5."Aliases` ". "SET `EntityType` = 'n' ". "WHERE `EntityType` = ''" ); if (!strstr($h4fded['Actions'],'`ReadCount`')) { u0738( "ALTER TABLE `". $e851f5."Actions` ". "ADD `ReadCount` INT DEFAULT '0' NOT NULL" ); } if (!strstr($h4fded['Actions'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Actions` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if(strstr($h4fded['Actions'],'`HitCount`')) { u0738( "ALTER TABLE `". $e851f5."Actions` ". "DROP `HitCount`" ); u0738( "DELETE FROM `". $e851f5."Actions` ". "WHERE `ReadCount` = 0" ); } if (!strstr($h4fded['GIPsSessions'],'`AuthorEmail`')) { u0738( "ALTER TABLE `". $e851f5."GIPsSessions` ". "ADD `AuthorEmail` VARCHAR(255) DEFAULT '' NOT NULL AFTER `AuthorName`" ); } if (!strstr($h4fded['GIPsSessions'],'`AuthorProfileLink`')) { u0738( "ALTER TABLE `". $e851f5."GIPsSessions` ". "ADD `AuthorProfileLink` VARCHAR(255) DEFAULT '' NOT NULL AFTER `AuthorEmail`" ); } if (!strstr($h4fded['GIPsSessions'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."GIPsSessions` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } if (!strstr($h4fded['Sources'],'`TrueID`')) { u0738( "ALTER TABLE `". $e851f5."Sources` ". "ADD `TrueID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); u0738( "UPDATE `". $e851f5."Sources` ". "SET `TrueID` = `ID`" ); } if (!strstr($h4fded['Sources'],'`SubsetID`')) { u0738( "ALTER TABLE `". $e851f5."Sources` ". "ADD `SubsetID` INT UNSIGNED DEFAULT '0' NOT NULL AFTER `ID`" ); } return true; } function ldb59($e851f5){ global$_model; foreach(array_keys($_model) as $yd2ffa){ $x4b43b=m07e3($yd2ffa,$e851f5); if ($x4b43b){ $id89e2=$x4b43b['Collation']; if ($id89e2!='utf8_general_ci'){ if(Log::$ned2b5)__log('Migrate: Convert table '. $yd2ffa. ' to utf8'); u0738( "ALTER TABLE `". $e851f5.$yd2ffa ."` ". "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" ); } } } } function e2mig__queries_to_recreate_indexes_for_table_($oaab9e){ $ef78dd=$i4f12d=[]; $r7694f=( "SELECT s.column_name, s.table_name, s.index_name, s.non_unique ". "FROM information_schema.statistics s ". " JOIN information_schema.columns USING (table_name, table_schema, column_name) ". " JOIN information_schema.tables USING (table_name, table_schema) ". "WHERE s.table_schema = DATABASE() AND engine = 'InnoDB' ". " AND column_type like '%varchar%' AND table_name='".$oaab9e."'" ); u0738($r7694f); foreach (d0d6b() as $mf1965){ $ef78dd[] = sprintf( "DROP INDEX %s ON %s", $mf1965['index_name'], $mf1965['table_name'] ); $i4f12d[] = sprintf( "CREATE %s INDEX %s ON %s(%s(191))", $mf1965['non_unique']?'':'UNIQUE', $mf1965['index_name'], $mf1965['table_name'], $mf1965['column_name'] ); } return array ($ef78dd,$i4f12d); } function rb01c($e851f5){ global$_model,$_db; $k752cb=kd372(); foreach ($k752cb as $d8ce4b => $t9e366){ $k752cb[$d8ce4b]=SEARCH_EXTRA_PREFIX. $t9e366; } $c0b95a=array_merge( array_keys($_model), array_values($k752cb) ); $ef78dd=$i4f12d=null; foreach ($c0b95a as $yd2ffa){ if(Log::$ned2b5)__log('Migrate: Convert table '. $yd2ffa. ' to utf8mb4?'); $x4b43b=m07e3($yd2ffa,$e851f5); if ($x4b43b){ $id89e2=$x4b43b['Collation']; if(stripos($id89e2,'utf8mb4')!==0){ list ( $ef78dd, $i4f12d )=e2mig__queries_to_recreate_indexes_for_table_($e851f5.$yd2ffa); if ($ef78dd!==null){ if(Log::$ned2b5){ __log('Migrate: Drop indexes of table '. $yd2ffa); } foreach ($ef78dd as $teaf65){ u0738($teaf65); } } if(Log::$ned2b5){ __log('Migrate: Convert table '. $yd2ffa. ' to UTF8MB4'); } u0738( "ALTER TABLE `". $e851f5.$yd2ffa ."` ". "CONVERT TO CHARACTER SET utf8mb4" ); if ($i4f12d!==null){ if(Log::$ned2b5){ __log('Migrate: Recreate indexes of table '.$yd2ffa); } foreach ($i4f12d as $e2464f){ u0738($e2464f); } } } } } } function e2s_migrate(){ cbb8d(); die ('Database migration finished.'); } function e2s_update_perform(){ global$_model,$settings,$_config,$_diagnose; $c7123a=n2ac5(); $dd98a0=max((int) ($c7123a['version']), 2285); if ($c7123a['version']==E2_VERSION){ j4930(); die; } if($_config['log_updates']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('update-$'); } if(Log::$ned2b5)__log('Update from v'. $dd98a0 .' to v'. E2_VERSION.' {'); if ($dd98a0 < 2587){ jc5a6('caches/*'); rmdir('caches'); } if ($dd98a0 < 2691){ $settings=e2_utf8_version_of_array_($settings); if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { q8a40($_strings['er--cannot-save-data'],E2E_PERMISSIONS_ERROR); k4006(); } } if ($dd98a0 < 2921){ $settings['template']='plain'; } if ($dd98a0 < 3223){ $settings['v3223_rss_permalinks_before_stamp']=time(); } if ($dd98a0 < 3354){ @rename('pictures/userpics/',AVATARS_FOLDER); @unlink(USER_FOLDER. 'password-reset.txt'); } if ($dd98a0 < 3496){ $settings['appearance']['respond_to_dark_mode']=true; } @unlink(USER_FOLDER. 'last-update.psa'); @unlink(CACHES_FOLDER.'index.xml'); @eaf42(CACHES_FOLDER); @eaf42(BACKUP_FOLDER); @eaf42(MEDIA_ROOT_FOLDER.PICTURES_FOLDER .'remote/'); @eaf42(MEDIA_ROOT_FOLDER.THUMBNAILS_FOLDER .'remote/'); if (@$settings['template']=='')$settings['template']=DEFAULT_TEMPLATE; if (isset ($settings['appearance']['hot_frontpage'])) { unset($settings['appearance']['hot_frontpage']); } if (isset ($settings['db']['table_prefix'])) { if($settings['db']['table_prefix'] != @$_config['db_table_prefix']) { die ('Youve been using a database with a table prefix '. $settings['db']['table_prefix'] .'. Now this should be set in the configuration. Please add the following line to the file user/config.php:<br /><br />$_config[\'db_table_prefix\'] = \''. $settings['db']['table_prefix'] .'\';<br /><br />Then refresh this page.'); } else { unset($settings['db']['table_prefix']); } } if (isset ($settings['comments']['on'])) { if (!$settings['comments']['on']) { try { u0738( "UPDATE LOW_PRIORITY `". $_config['db_table_prefix']."Notes` ". "SET `IsCommentable`=0 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ); } catch (AeMySQLException $e){} } $settings['comments']['default_on'] = (bool)$settings['comments']['on']; unset($settings['comments']['on']); } if ( is_file(USER_FOLDER.'settings.json') and is_file(USER_FOLDER.'settings.psa') ) { @unlink(USER_FOLDER.'settings.psa'); } if (!@k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE))) { q8a40($_strings['er--cannot-save-data'],E2E_PERMISSIONS_ERROR); } e2_drop_all_kinds_of_cache(); cbb8d(); if ($dd98a0 < 3386){ if (ha521()) { $fddece=a476c(); try { $fddece -> erase(); } catch (\S2\Rose\Exception\RuntimeException $e){ if(Log::$ned2b5)__log('Rose not available'); } } c198f(); } $_diagnose['need?']=true; ic64a('diagnose','1'); $c7123a=s5be8(E2_VERSION); if(Log::$ned2b5)__log('}'); if (we852()) { q8a40(e2l_get_string('gs--updated-successfully', array ( 'from' => 'v'. $dd98a0, 'to' => 'v'. $c7123a['version'], )), E2E_MESSAGE); } e2_go_to(); die; } define('E2_MYSQL_CONNECT_TIMEOUT',5); function q985b($mfa48c='',$d78940=null){ static $u060d3=false; global$settings,$_db,$k11755,$_config; if ($u060d3) return; if ($d78940===null)$d78940=$settings['db']; $kd51e8=mysqli_init(); $kd51e8 -> options(MYSQLI_OPT_CONNECT_TIMEOUT,E2_MYSQL_CONNECT_TIMEOUT); if($_config['dev_chaos'] and !rand(0, (1/$_config['dev_chaos']) - 1)) { throw new AeMySQLCannotConnectException('Could not '. $mfa48c ."\n\nChaos in e2_mysql_ensure"); } $x06aa6=@mysqli_real_connect( $kd51e8, 'p:'. $d78940['server'], $d78940['user_name'], iee85($d78940['passw']) ); if (!$x06aa6){ $u70106=mysqli_connect_errno(); if ($u70106==1045){ $x06aa6=@mysqli_real_connect( $kd51e8, 'p:'. $d78940['server'], $d78940['user_name'], $d78940['passw'] ); if ($x06aa6){ $d78940['passw']=n1305($d78940['passw']); $settings['db']=$d78940; if(Log::$ned2b5)__log('Storing encrypted password'); @k6e52(USER_FOLDER.'settings.json',json_encode($settings,E2_JSON_STYLE)); } else { throw new AeMySQLAccessDeniedException('Could not '. $mfa48c); } } else { throw new AeMySQLCannotConnectException('Could not '. $mfa48c); } } $_db['version']=mysqli_get_server_info($kd51e8); if(version_compare($_db['version'],E2_MINIMUM_MYSQL,'<')) { throw new AeMySQLTooOldException('Could not '. $mfa48c); } if (!@mysqli_select_db($kd51e8,$d78940['name'])) { throw new AeMySQLNotFoundException('Could not '. $mfa48c); } $_db['link']=$kd51e8; $_db['charset']=version_compare($_db['version'],'5.5.3','>=')?'utf8mb4':'utf8'; $b1b1cc='SET NAMES '. $_db['charset']; mysqli_query($kd51e8,$b1b1cc); @$k11755 ++; if(Log::$ned2b5)__log('DB ['. $k11755 .']: '. $b1b1cc); $u060d3=true; } function u0738($b1b1cc,$mfa48c='run some query'){ global $k11755,$_db,$_strings,$_config; q985b($mfa48c); if($_config['dev_chaos'] and !rand(0, (1/$_config['dev_chaos']) - 1)) { throw new AeMySQLQueryException('Could not '. $mfa48c ."\n\nChaos in e2_mysql_query"); } @$k11755 ++; if(Log::$ned2b5) if ($mfa48c)__log('Will '. $mfa48c); if(Log::$ned2b5)__log('DB ['. $k11755 .']: '. $b1b1cc); $_db['result'] = @mysqli_query($_db['link'],$b1b1cc); if (!$_db['result']) { throw new AeMySQLQueryException('Could not '. $mfa48c ."\n\nMySQL says:\n". mysqli_error($_db['link'])); } } function d0d6b($type=MYSQLI_ASSOC){ global$_db; $r2cb9d=array(); while ($h0cc17=@mysqli_fetch_array($_db['result'],$type)) { foreach ($h0cc17 as $f865c0 => $j4921c){ if(is_string($j4921c)) { $h0cc17[$f865c0]=$j4921c; } } $r2cb9d[] = $h0cc17; } return $r2cb9d; } function a7928($fb45cf){ global$_db; q985b('escape string'); return mysqli_real_escape_string($_db['link'],$fb45cf); } function lb488(){ echo '<pre>'; echo 'Sifting backups...<br>'; $d10ae9=array(); foreach(glob(BACKUP_FOLDER. '*.sql') as $d8c7dd){ if(preg_match('/^backup\-(\d+)\-(\d+)\-(\d+)\-at\-(\d+)\-(\d+)\-(\d+)\.sql$/is',basename($d8c7dd),$j9c28d)) { list (, $q41529,$t6f8f5,$r8277e,$o2510c,$f865c0,$z03c7c)=$j9c28d; $k96b8c=gmmktime($o2510c,$f865c0,$z03c7c,$t6f8f5,$r8277e,$q41529); $d10ae9[$k96b8c]=$d8c7dd; } } if(count($d10ae9) > 3){ echo 'More than 3 backups, time to sift...<br>'; $i536a1=-1; $mf46c9=array (SECONDS_IN_A_MINUTE,SECONDS_IN_AN_HOUR,SECONDS_IN_A_DAY, -1); $f865c0=0; foreach(array_reverse($d10ae9,true) as $k96b8c => $d8c7dd){ echo '-> '. $d8c7dd .' ('. gmdate('r',$k96b8c) .')<br>'; if ($i536a1 == -1){ echo '   latest, leave<br>'; $i536a1=$k96b8c; } elseif ($mf46c9[$f865c0] == -1){ echo '   too old, remove<br>'; unlink($d8c7dd); } else { if ($i536a1-$k96b8c < $mf46c9[$f865c0]) { echo '   no need (not long ago), remove<br>'; unlink($d8c7dd); } else { $f865c0 ++; echo '   ok, leave, set interval to '. $mf46c9[$f865c0] .'<br>'; $i536a1=$k96b8c; } } } } else { echo 'No need to sift<br>'; } echo '</pre>'; return; } function e2s_dump(){ global$_model,$_db,$_config; try { q985b('make backup'); if($_db['link']) { $m68720=time() - (SECONDS_IN_A_DAY); $u9ab2e=array(); foreach(array_keys($_model) as $oaab9e){ $u9ab2e[] = $_config['db_table_prefix'].$oaab9e; } $g07cc6=time(); $j435ed=BACKUP_FOLDER .'backup-'.gmdate('Y-m-d-\a\t-H-i-s',$g07cc6).'.sql'; e2_backup( $_db['link'], $u9ab2e, $j435ed ); lb488(); die ('Backed up.'); } } catch (AeMySQLException $e){ b12f6($e,'Could not do backup'); die ('Could not do backup.'); } } define('ALIAS_MAX_LENGTH',64); function e2ali__alias_from_title_($h36cd3){ global$_config; $p3e891=$h36cd3; if(array_key_exists('autoreplace_for_aliases',$_config)) { $p3e891=strtr( $p3e891, $_config['autoreplace_for_aliases'] ); } $p3e891=l2183($p3e891); $p3e891=str_replace('\'','',$p3e891); $p3e891=str_replace('','',$p3e891); $p3e891=str_replace(chr(146),'',$p3e891); $v17901=''; for ($f865c0=0; $f865c0 < strlen($p3e891); ++ $f865c0){ if ( (ord($p3e891[$f865c0]) >= 48 and ord($p3e891[$f865c0]) <= 57) or (ord($p3e891[$f865c0]) >= 65 and ord($p3e891[$f865c0]) <= 90) or (ord($p3e891[$f865c0]) >= 97 and ord($p3e891[$f865c0]) <= 122) or 0 ){ $v17901.=$p3e891[$f865c0]; } else { $v17901.='-'; } } $v17901=preg_replace('/\-+/','-',$v17901); $v17901=trim($v17901,'-'); $v17901=strtolower($v17901); if ($v17901=='-')$v17901=''; $v17901=substr($v17901,0,ALIAS_MAX_LENGTH); return $v17901; } function e2_aliasrec_of_alias_($k72487){ global$_config; if ((string)$k72487==='') return false; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Aliases` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `Alias` = '". $k72487 ."' ". "ORDER BY `Stamp` LIMIT 1", 'get database record for alias "'. $k72487 .'"' ); $result=d0d6b(); if(count($result)==1){ return$result[0]; } else { return false; } } function e2_active_alias_for_page_($l89111,$rdffc4){ global$_config,$_e2_active_aliases; if ($rdffc4){ if ( is_array($_e2_active_aliases) and array_key_exists($l89111.$rdffc4,$_e2_active_aliases) ) { if(Log::$ned2b5)__log( 'Aliases: alias of entity "'. $l89111 .'" id "'. $rdffc4 .'" '. 'is livecached as "'. @$_e2_active_aliases[$l89111.$rdffc4] .'"' ); return @$_e2_active_aliases[$l89111.$rdffc4]; } else { u0738( "SELECT `Alias` ". "FROM `". $_config['db_table_prefix']."Aliases` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `EntityType` = '". $l89111 ."' ". "AND `EntityID` = ". $rdffc4 ." ". "ORDER BY `Stamp` DESC LIMIT 1", 'get alias record for entity "'. $l89111 .'" id '. $rdffc4.' to detect active alias' ); $result=d0d6b(); $k72487=$result[0]['Alias']; if (!$k72487 and $l89111==ENTITY_TYPE_TAG){ u0738( "SELECT OriginalAlias ". "FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". ((int)$rdffc4)."'", 'get orginial alias for tag id '. $rdffc4.' to detect active alias' ); $result=d0d6b(); $k72487=$result[0]['OriginalAlias']; } $_e2_active_aliases[$l89111.$rdffc4]=$k72487; } if(Log::$ned2b5)__log('Got alias "'. @$_e2_active_aliases[$l89111.$rdffc4] .'"'); return @$_e2_active_aliases[$l89111.$rdffc4]; } } function od712($y15d61,$l89111,$rdffc4,$h36cd3,$bfb873=1){ global$_e2_active_aliases; if(Log::$ned2b5)__log('Aliases: "'. $y15d61 .'" available alias for source "'. $h36cd3. '"'); if ($y15d61=='set' and (!$l89111 or !$rdffc4)) return false; $v17901=e2ali__alias_from_title_($h36cd3); if ($h36cd3!=='' and $v17901===''){ $v17901=(string)$bfb873; } elseif ($bfb873 > 1){ $o9f626='-'. $bfb873; $v17901=substr($v17901,0,ALIAS_MAX_LENGTH-strlen($o9f626)) . $o9f626; } if ($uc45dd=e2_aliasrec_of_alias_($v17901)) { $d6bae4=$uc45dd['EntityType']; $u1123c=$uc45dd['EntityID']; if ( (($rdffc4 and $u1123c==$rdffc4) and ($l89111 and $d6bae4==$l89111)) or $v17901!=e2_active_alias_for_page_($d6bae4,$u1123c) ) { if ($y15d61=='find'){ return $v17901; } if ($y15d61=='set'){ if(Log::$ned2b5)__log('Aliases: update alias timestamp'); qaa79('Aliases', array ( 'ID' => $uc45dd['ID'], 'EntityType' => $l89111, 'EntityID' => $rdffc4, 'Alias' => $v17901, 'Stamp' => time(), )); return$_e2_active_aliases[$l89111.$rdffc4]=$v17901; } } else { return od712($y15d61,$l89111,$rdffc4,$h36cd3,$bfb873+1); } } else { if ($l89111 and $rdffc4 and $v17901==''){ if(e2_active_alias_for_page_($l89111,$rdffc4)==''){ return ''; } } if(Log::$ned2b5)__log('Aliases: its an empty alias, and it was not being used for this entity'); if ( $l89111==ENTITY_TYPE_TAG and $dd62e3=c8770($v17901) ) { if ($dd62e3['ID']!=$rdffc4){ return od712($y15d61,$l89111,$rdffc4,$h36cd3,$bfb873+1); } } if ($y15d61=='find'){ return $v17901; } if ($y15d61=='set'){ v9943('Aliases', array ( 'EntityType' => $l89111, 'EntityID' => $rdffc4, 'Alias' => $v17901, 'Stamp' => time(), )); return$_e2_active_aliases[$l89111.$rdffc4]=$v17901; } } return ''; } function e2m_note($parameters=array ()) { global $settings, $x57de2, $_config, $_superconfig, $_strings; if(Log::$ned2b5)__log('Note {'); $saad65=$parameters['*note']; if ($saad65==false){ return e2_error404_mode(); } if (!yb44b($saad65,we852())) { return e2_error404_mode(); } $gd58c0=x83c8('e2m_note',$parameters); if(Log::$ned2b5)__log('Navigation {'); $ifcb08=mcca7($saad65,'prev'); $ed0cab=mcca7($saad65,'next'); if ($ifcb08){ $db3b32['prev-href']=x83c8('e2m_note', array ('*note' => $ifcb08)); $db3b32['prev-title']=u6f10(htmlspecialchars($ifcb08['Title'],ENT_NOQUOTES,HSC_ENC)); } if ($ed0cab){ $db3b32['next-href']=x83c8('e2m_note', array ('*note' => $ed0cab)); $db3b32['next-title']=u6f10(htmlspecialchars($ed0cab['Title'],ENT_NOQUOTES,HSC_ENC)); } $db3b32['title']=$_strings['nm--posts']; $db3b32['timeline?']=false; $db3b32['this-title']=u6f10(htmlspecialchars($saad65['Title'],ENT_NOQUOTES,HSC_ENC)); if(Log::$ned2b5)__log('}'); if(Log::$ned2b5)__log('Packaging...'); $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_ord']=0; $saad65['_']['_ord_max']=0; $q8e4cd=o6791($saad65); $ye35b1=''; $s33ff2=false; $g905f7=false; $s7bae4=array(); $ud09b4=''; if (we852()) { $l83625=e2_note_cache_filename_with_id_($saad65['_']['_id'] .'-comments-author'); } else { $l83625=e2_note_cache_filename_with_id_($saad65['_']['_id'] .'-comments'); } $u1e8cc=null; if(CACHE_NOTES_COMMENTS and is_file($l83625)) { $u1e8cc=@unserialize(file_get_contents($l83625)); } if(Log::$ned2b5)__log('Comments {'); if(is_array($u1e8cc)) { if(Log::$ned2b5)__log('retrieve cached ctree'); $ye35b1=$u1e8cc; } else { if(Log::$ned2b5)__log('assemble ctree...'); $xc1fdc=n70a7($saad65['ID']); $na5d49=array(); $s04c25=true; foreach ($xc1fdc as $d8ce4b => $l4032b){ if ($l4032b['IsVisible']) { $l4032b['_']['_id']=$l4032b['ID']; $l4032b['_']['_ord']=$d8ce4b; $l4032b['_']['_ord_max']=count($xc1fdc)-1; $z06d4c=f86f8( $saad65, $l4032b, $d8ce4b+1 ); if ($z06d4c['new?'] and $s04c25){ $z06d4c['first-new?']=true; $s04c25=false; } $na5d49[] = $z06d4c; } } $ye35b1=$na5d49; if(CACHE_NOTES_COMMENTS)k6e52($l83625,serialize($ye35b1)); } if(Log::$ned2b5)__log('} // Comments'); if (!@$_config['read_only'] and $q8e4cd['commentable-now?']) { $b80f02=f66aa($saad65); $b80f02['.comment-number']=count($ye35b1)+1; } if (we852() and gb387($saad65,NOTE_COMMENTABLE_NOW_CONDITIONALLY)) { if ($saad65['IsCommentable']) { $s7bae4['href']=x83c8('e2m_note_flag', array ( '*note' => $saad65, 'flag' => 'IsCommentable', 'value' => 0, )); $s7bae4['text']=$_strings['bt--close-comments-to-post']; } else { $s7bae4['href']=x83c8('e2m_note_flag', array ( '*note' => $saad65, 'flag' => 'IsCommentable', 'value' => 1, )); $s7bae4['text']=$_strings['bt--open-comments-to-post']; } } if ( we852() and array_key_exists('new-comments-count',$q8e4cd) and $q8e4cd['new-comments-count'] ) { if(Log::$ned2b5)__log('mark comments as not new'); e2_drop_caches_for_note_($y21158); qaa79('Comments', array ('IsNew' => 0), array ('NoteID' => $saad65['_']['_id'])); } if(Log::$ned2b5)__log('more work...'); $we70c4['title']=$saad65['Title']; $we70c4['pages']=$db3b32; $we70c4['summary']=$q8e4cd['summary']; $we70c4['notes'] = array ('only' => $q8e4cd); if ($ye35b1) $we70c4['comments']['each']=$ye35b1; if ($s7bae4) $we70c4['comments']['toggle']=$s7bae4; $we70c4['comments']['count']=$q8e4cd['comments-count']; $we70c4['comments']['count-text']=$q8e4cd['comments-count-text']; $we70c4['comments']['new-count']=$q8e4cd['new-comments-count']; $we70c4['comments']['new-count-text']=$q8e4cd['new-comments-count-text']; $we70c4['comments']['commentable-now?']=$q8e4cd['commentable-now?']; if ($b80f02){ $we70c4['form-comment']=$b80f02; } if(Log::$ned2b5)__log('} // Note'); return $we70c4; } function e2m_note_read($parameters=array ()) { if(Log::$ned2b5)__log('Note read {'); $saad65=$parameters['*note']; $zff089=time(); $zff089=$zff089 - ($zff089 % SECONDS_IN_AN_HOUR); v9943( 'Actions', array ( 'EntityID' => $saad65['ID'], 'Stamp' => $zff089, 'ReadCount' => 1, ), 'INSERT LOW_PRIORITY', 'ON DUPLICATE KEY UPDATE `ReadCount` = `ReadCount` + 1' ); if(Log::$ned2b5)__log('}'); e2_go_to(x83c8('e2m_note',$parameters)); } function e2m_note_withdraw($parameters=array ()) { global$_strings; $oea59a=$parameters['*note']; if (!$oea59a) return e2_error404_mode(); if($_SERVER['REQUEST_METHOD']!='POST'){ return e2_go_to(x83c8('e2m_note', array ('*note' => $oea59a))); } $q22db1=x83c8('e2m_note_broadcast', array ('*note' => $oea59a)); $oea59a['IsPublished']=0; $oea59a['IsCommentable']=0; $oea59a['IsVisible']=1; $oea59a['Stamp']=time(); $oea59a['IP']=p1668(); if($parameters['alias']) { $oea59a['OriginalAlias']=$parameters['alias']; } else { $oea59a['OriginalAlias']=od712( 'find',ENTITY_TYPE_NOTE,$oea59a['ID'],$oea59a['Title'] ); } e2_drop_caches_for_note_($oea59a['ID']); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); if ($oea59a['IsFavourite']) { @unlink(CACHE_FILENAME_FAVS); } qaa79('Notes',$oea59a); s10fe($oea59a['ID']); gcc38($q22db1); od712('set',ENTITY_TYPE_NOTE,$oea59a['ID'],''); e2_go_to(x83c8('e2m_draft', array ( '*note' => $oea59a, ))); } function e2m_note_delete($parameters=array()) { global$_strings; $oea59a=$parameters['*note']; if (!$oea59a) return e2_error404_mode(); $vf91b2=!$oea59a['IsPublished']; if ($vf91b2){ $e72bd7=e2l_get_string('gs--draft-will-be-deleted', array ( 'draft' => htmlspecialchars($oea59a['Title'],ENT_NOQUOTES,HSC_ENC), )); } else { $e72bd7=e2l_get_string('gs--post-will-be-deleted', array ( 'post' => htmlspecialchars($oea59a['Title'],ENT_NOQUOTES,HSC_ENC), )); } $ld5d3d=$vf91b2? $_strings['pt--draft-deletion']:$_strings['pt--post-deletion']; $v57529=array ( '.note-id' => $oea59a['ID'], '.is-draft' => (int)$vf91b2, 'note-title' => htmlspecialchars($oea59a['Title'],ENT_COMPAT,HSC_ENC), 'caution-text' => $e72bd7, 'form-action' => x83c8('e2s_note_delete'), 'submit-text' => $_strings['fb--delete'], 'draft?' => (int)$vf91b2, ); if ($oea59a['IsPublished']) { $v57529['withdraw-href']=x83c8( 'e2m_note_withdraw',$parameters ); } $r2cb9d=array ( 'title' => $ld5d3d. ': '. htmlspecialchars($oea59a['Title'],ENT_NOQUOTES,HSC_ENC), 'heading' => $ld5d3d, 'form' => 'form-note-delete', 'form-note-delete' => $v57529, ); return $r2cb9d; } function e2m_note_flag_favourite($parameters){ global$_config; $parameters['flag']='IsFavourite'; r705b([ 'flag-name' => 'favourite', 'candy-name' => 'e2m_note_flag_favourite', 'parameters' => $parameters, 'flipping-function' => function () use ($parameters){ l7e6c($parameters); }, ]); } function e2m_note_flag($parameters){ l7e6c($parameters); if(array_key_exists('draft',$parameters)) { e2_go_to(x83c8('e2m_draft',$parameters)); } else { e2_go_to(x83c8('e2m_note',$parameters)); } die; } function l7e6c($parameters){ $y21158=$parameters['*note']['ID']; if (!is_numeric($y21158)) { return e2_error404_mode(); } e2_drop_caches_for_note_($y21158); if($parameters['flag']=='IsFavourite'){ @unlink(CACHE_FILENAME_FAVS); } if($parameters['flag']=='IsVisible'){ i7996(); } qaa79('Notes', array ( 'ID' => $y21158, $parameters['flag'] => (int) ($parameters['value']==1), )); try { $w39a37=i4627($y21158); b5b68($w39a37); } catch (AeMySQLException $e){ b12f6($e,'Could not broadcast note flag change'); } return true; } function e2m_note_use_formatter($parameters){ $y21158=$parameters['*note']['ID']; if (!is_numeric($y21158)) { return e2_error404_mode(); } e2_drop_caches_for_note_($y21158); if (!$parameters['*note']['IsPublished']) { @unlink(CACHE_FILENAME_DRAFTS); } if(in_array($parameters['formatter'], array ('calliope','raw','neasden'))) { qaa79('Notes', array ( 'ID' => $y21158, 'FormatterID' => $parameters['formatter'], )); echo 'formatter set to '. $parameters['formatter']; } else { echo 'unknown formatter'; } die; } function w7dd3($p60cd8,$parameters=array ()) { global$full_blog_url,$_strings,$_config; $ld5d3d=$_strings['pt--new-post']; $cf74f5=$_strings['pt--new-post']; $y21158='new'; $j9763c=$_config['default_formatter']; if ($p60cd8=='edit'){ $oea59a=$parameters['*note']; if (!$oea59a) return e2_error404_mode(); if ($oea59a){ if ($oea59a['IsPublished']) { $cf74f5=$_strings['pt--edit-post']; $z3aa13=''; $k72487=$parameters['alias']; } else { $cf74f5=$_strings['pt--edit-draft']; $z3aa13=od712( 'find',ENTITY_TYPE_NOTE,$oea59a['ID'],$oea59a['Title'] ); if (@$oea59a['OriginalAlias']) { $k72487=$oea59a['OriginalAlias']; } else { $k72487=$z3aa13; } } } $y21158=$oea59a['ID']; $j9763c=$oea59a['FormatterID']; $ld5d3d=$oea59a['Title']; } $q04868=ubb5b(); $f77b75=array(); if ($q04868!==null) foreach ($q04868 as $qd7df5){ $f77b75[] = $qd7df5['tag']; } $cd2e3e=array(); if ($p60cd8=='edit' and count($f77b75)) { $q04868=ace23($oea59a['ID']); foreach ($q04868 as $qd7df5){ $cd2e3e[] = htmlspecialchars($qd7df5['Keyword'],ENT_NOQUOTES,HSC_ENC); } } $kc93df=array(); foreach ($f77b75 as $qd7df5){ $lfd2ef['name']=$qd7df5; $lfd2ef['selected?']=in_array($qd7df5,$cd2e3e); $kc93df[] = $lfd2ef; } $z9dbb8=''; $cd2e3e=implode(', ',$cd2e3e); if ($cd2e3e)$z9dbb8=$cd2e3e; if ($p60cd8=='write'){ $sc50d0=$_strings['fb--save-and-preview']; } if ($p60cd8=='edit'){ if(array_key_exists('draft',$parameters)) { $sc50d0=$_strings['fb--save-and-preview']; } else { $sc50d0=$_strings['fb--save-changes']; } } $se449c=array(); if ($p60cd8=='edit'){ $se449c=rc0c4( $oea59a['FormatterID'],$oea59a['Text'],'full' ); } $t75e1b=hf898( 'note',$y21158,$se449c ); if ($p60cd8=='edit'){ t2f83( 'Notes', $oea59a, $se449c ); } $k96b8c=min($oea59a['Stamp'],time()); $hc999b=yd10e(); $f85faf=x1363($hc999b); $r2cb9d['title']=$ld5d3d; $r2cb9d['heading']=$cf74f5; $r2cb9d['form']='form-note'; $r2cb9d['uploads'] = [ 'enabled?' => $f85faf, 'each' => $t75e1b, 'upload-action' => x83c8('e2j_file_upload'), 'remove-action' => x83c8('e2j_file_remove'), ]; $r2cb9d['form-note'] = array ( '.note-id' => $y21158, '.formatter-id' => $j9763c, '.from' => substr($_SERVER['HTTP_REFERER'],strlen($full_blog_url)+1), '.old-tags-hash' => md5($z9dbb8), '.action' => $p60cd8, 'form-action' => x83c8('e2s_note_process'), 'form-note-livesave-action' => x83c8('e2j_note_livesave'), 'create:edit?' => (bool) ($p60cd8=='write'), 'title' => htmlspecialchars($oea59a['Title'],ENT_COMPAT,HSC_ENC), 'tags' => $z9dbb8, 'tags-info' => $kc93df, 'text' => htmlspecialchars($oea59a['Text'],ENT_NOQUOTES,HSC_ENC), 'all-tags' => $f77b75, 'stamp-formatted' => h5a2f('d.m.Y H:i:s',$k96b8c,l0923($oea59a)), 'time' => $oea59a['IsPublished']? array ((int)$k96b8c,l0923($oea59a)) : false, 'alias-autogenerated' => $z3aa13, 'uploads-enabled?' => $f85faf, 'alias' => $k72487, 'submit-text' => $sc50d0, 'space-usage' => zaf64($hc999b), ); if ($p60cd8=='edit'){ $r2cb9d['related-delete-href']=x83c8( 'e2m_note_delete', array ('*note' => $oea59a) ); if (!array_key_exists('draft',$parameters)) { $oea59a['_']['_id']=$oea59a['ID']; $oea59a['_']['_ord']=0; $oea59a['_']['_ord_max']=0; $r2cb9d['form-note']['note']=o6791($oea59a); } } return $r2cb9d; } function e2m_note_edit($parameters=array ()) { return w7dd3('edit',$parameters); } function e2m_write(){ return w7dd3('write'); } function e2s_note_process(){ global$_fp_error,$_strings; $y21158=na21e(); if (!$y21158){ if($_fp_error==FP_TITLE_OR_TEXT_EMPTY){ q8a40($_strings['er--post-must-have-title-and-text'],E2E_USER_ERROR); } elseif($_fp_error==FP_NO_ID_OR_NEW){ } else { q8a40($_strings['er--error-occurred']); } e2_go_to(x83c8('e2m_write')); die; } try { $saad65=i4627($y21158); if ($saad65['IsPublished']) { e2_go_to(x83c8('e2m_note', array ('*note' => $saad65))); } else { e2_go_to(x83c8('e2m_draft', array ('*note' => $saad65))); } } catch (AeMySQLException $e){ b12f6($e,'Could not get note by ID'); e2_go_to(); } die; } function e2s_note_publish(){ global$_strings,$_config,$settings; $y21158=false; if(array_key_exists('note-id',$_POST)) { $y21158=$_POST['note-id']; $iaddfe=false; $oea59a=i4627($y21158); $i82b30=$oea59a['OriginalAlias']; $p098ae=$oea59a['Stamp']; $xbb4fe=!$oea59a['IsExternal']; $oea59a['ID']=$y21158; $oea59a['IsVisible']=1; $oea59a['IsPublished']=1; $oea59a['IsCommentable'] = (int)$settings['comments']['default_on']; $oea59a['IsFavourite']=0; if(array_key_exists('browser-offset',$_POST)) { $mb2c6c=ja618(@$_POST['browser-offset']); } else { $mb2c6c=g5c05(); } if ($iaddfe and $k96b8c=d1630($iaddfe,$mb2c6c)) { $oea59a['Stamp']=$k96b8c; } elseif ($xbb4fe){ $oea59a['Stamp']=time(); } else { $oea59a['Stamp']=$p098ae; } if (vd2e1($oea59a)) { $oea59a['IsIndexed']='1'; } if ($mb2c6c){ $oea59a['Offset'] = (int)$mb2c6c['offset']; $oea59a['IsDST'] = (int)$mb2c6c['is_dst']; } e2_drop_caches_for_note_($y21158); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); qaa79('Notes',$oea59a); $k72487=''; if ($i82b30 or $i82b30==='0'){ $k72487=od712('set',ENTITY_TYPE_NOTE,$y21158,$i82b30); $oea59a['OriginalAlias']=$k72487; } if ($k72487!=$i82b30){ qaa79('Notes',$oea59a); } if (yb44b($oea59a)) { b5b68($oea59a); } e2_go_to(x83c8('e2m_note', array ('*note' => $oea59a))); die; } e2_go_to(); die; } function le268($y21158,$l9a92d=-1){ global$_config; e2_drop_caches_for_note_($y21158); if ($l9a92d or $l9a92d === -1){ @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); } if (!$l9a92d or $l9a92d === -1) { @unlink(CACHE_FILENAME_FAVS); } u0738( "DELETE FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". ((int)$y21158) ."'", 'delete note by ID' ); s10fe($y21158); u0738( "DELETE FROM `". $_config['db_table_prefix']."Aliases` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `EntityID`=". ((int)$y21158), 'delete aliases after deleting note' ); u0738( "DELETE FROM `". $_config['db_table_prefix']."NotesKeywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". ((int)$y21158), 'delete tag bindings after deleting note' ); } function e2s_note_delete(){ global$_strings,$_config; $y21158=$_POST['note-id']; $l9a92d=(bool)$_POST['is-draft']; $oea59a=i4627($y21158); $q22db1=x83c8('e2m_note_broadcast', array ('*note' => $oea59a)); le268($y21158,$l9a92d); gcc38($q22db1); if ($l9a92d){ e2_go_to(x83c8('e2m_drafts')); } else { e2_go_to(); } die; } function e2j_note_livesave(){ die (na21e('ajaxresult')); } function o6791($saad65,$r8698e=false){ global $settings, $_config, $_superconfig, $_candy, $_current_tag, $x57de2, $ee5564, $full_blog_url; if (!is_numeric($saad65['_']['_id'])) return false; $bda497=e2_note_cache_filename_with_id_($saad65['_']['_id']); $ke244c=null; if(CACHE_NOTES and is_file($bda497)) { $ke244c=@unserialize(file_get_contents($bda497)); } if(Log::$ned2b5)__log('Notes: package note <'. $saad65['_']['_id'] .'>...'); $ee919a=v7f78(); if(CACHE_NOTES and is_array($ke244c)) { if(Log::$ned2b5)__log('Notes: retrieve cached ctree'); $vc6827=$ke244c; } else { if(Log::$ned2b5)__log('Notes: assemle cacheable ctree...'); if(Log::$ned2b5)__log('Notes: formatter ID = '. $saad65['FormatterID']); $o2bfe4=j154e($saad65['FormatterID'], @$saad65['Text'],'full'); $vc6827['title'] = u6f10(htmlspecialchars($saad65['Title'],ENT_NOQUOTES,HSC_ENC)); $vc6827['text'] = $o2bfe4['text-final']; $vc6827['summary'] = m5421($vc6827['text']); $vc6827['format-info'] = $o2bfe4['meta']; $vc6827['time'] = array ((int)$saad65['Stamp'],l0923($saad65)); $vc6827['last-modified'] = array ((int)$saad65['LastModified'],l0923($saad65)); $vc6827['last-ip'] = $saad65['IP']; $vc6827['published?'] = (bool)$saad65['IsPublished']; $vc6827['commentable?'] = (bool) ($saad65['IsCommentable'] && $saad65['IsPublished']); $vc6827['favourite?'] = (bool) ($saad65['IsFavourite'] && $saad65['IsPublished']); $vc6827['visible?'] = yb44b($saad65); $vc6827['scheduled?'] = false; $ad972d=@$saad65['SourceNoteData']; $ad972d=@json_decode($ad972d,true); $vc6827['source-main-image-url'] = @$ad972d['og_images'][0]; if(is_array($o2bfe4['meta']['resources-detected'])) { t6be4($o2bfe4['meta']['resources-detected']); } if (!$vc6827['published?'])$vc6827['time']=$vc6827['last-modified']; $vc6827['og-images']=tdbcc( 'note',$saad65['_']['_id'], $vc6827['format-info']['resources-detected'] ); $c0dff3=ace23($saad65['ID']); $hd57ac=array(); foreach ($c0dff3 as $f865c0 => $rb19ad){ $vc6827['og-images']=array_merge( $vc6827['og-images'], tdbcc('tag',$rb19ad['ID'], array ()) ); $le4d23['name']=htmlspecialchars($rb19ad['Keyword'],ENT_NOQUOTES,HSC_ENC); $le4d23['href']=x83c8('e2m_tag', array ('*tag' => $rb19ad)); $hd57ac[] = $le4d23; } $vc6827['tags']=$hd57ac; $g905f7=v254f($saad65['ID']); if ($vc6827['published?']) { $vc6827['comments-count']=$g905f7; } $ke244c=$vc6827; if(CACHE_NOTES) @k6e52($bda497,serialize($ke244c)); } if ($r8698e){ if(Log::$ned2b5)__log('Notes: short-track package for caching only'); if(Log::$ned2b5)__log('Notes: package note done in '. round(v7f78()-$ee919a,3)); return $vc6827; } if(Log::$ned2b5)__log('Notes: continue with the uncacheable, '. round(v7f78()-$ee919a,3) .' so far...'); $vc6827['commentable-now?']=gb387($saad65); if(array_key_exists('comments-count',$vc6827)) { $vc6827['comments-count-text']=e2l_get_string('gs--n-comments', array ( 'number' => $vc6827['comments-count'] )); } foreach ($vc6827['tags'] as $d8ce4b => $t9e366){ $vc6827['tags'][$d8ce4b]['current?'] = (bool) ($vc6827['tags'][$d8ce4b]['name']==$_current_tag); } $e2e88c=$saad65['IsPublished']?'e2m_note':'e2m_draft'; $vc6827['href']=x83c8($e2e88c, array ('*note' => $saad65)); if ($saad65['IsPublished']) { if ($saad65['OriginalAlias']) { $vc6827['href-original']=x83c8('e2m_note', array ('alias' => $saad65['OriginalAlias'])); } else { $l010d9=$saad65; $l010d9['__noalias!']=true; $vc6827['href-original']=x83c8('e2m_note', array ('*note' => $l010d9)); } } $vc6827=array_merge($vc6827,q1a48($saad65,true)); $vc6827['comments-link?'] = (bool) ( $saad65['IsPublished'] && (gb387($saad65) or ($vc6827['comments-count'] > 0)) && ('e2m_note'!=$_candy) ); if (we852()) { $mfe9e2=i3ce7($saad65['ID']); $vc6827['new-comments-count']=$mfe9e2; $vc6827['new-comments-count-text']=e2l_get_string('gs--comments-n-new', array ( 'number' => $mfe9e2 )); if ($saad65['IsPublished']) { if ($saad65['IsFavourite']) { $vc6827['favourite-toggle-href']=x83c8( 'e2m_note_flag_favourite', array ('*note' => $saad65,'value' => 0) ); } else { $vc6827['favourite-toggle-href']=x83c8( 'e2m_note_flag_favourite', array ('*note' => $saad65,'value' => 1) ); } } if (!@$_config['read_only']) { $vc6827['edit-href']=x83c8( 'e2m_note_edit', array ('*note' => $saad65) ); $d9920c=$vc6827['edit-href']; } } if($settings['appearance']['show_sharing_buttons']) { $deb769=$_config['share_to']; $k21bdd='|twitter|facebook|vkontakte|telegram|linkedin|whatsapp|'; if (@$_config['share_to_twitter_via']) { $s8d777['twitter']['via']=$_config['share_to_twitter_via']; } if(count($vc6827['og-images']) > 0){ $e62933=$vc6827['og-images'][0]; $k21bdd.='pinterest|'; $s8d777['pinterest']['media']=$e62933; } $vc6827['shareable?']=false; foreach(explode(',',$deb769) as $p5a9d3){ $p5a9d3=trim($p5a9d3); if(strstr($k21bdd,'|'. $p5a9d3. '|')) { $vc6827['shareable?']=true; $vc6827['share-to'][$p5a9d3]['share?']=true; if ($s8d777[$p5a9d3]) { $vc6827['share-to'][$p5a9d3]['data']=$s8d777[$p5a9d3]; } } } } if(array_key_exists('_',$saad65))$vc6827['_']=$saad65['_']; if(Log::$ned2b5)__log('Notes: package note done in '. round(v7f78()-$ee919a,3)); return $vc6827; } function i4627($xb80bb){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". $xb80bb ."'" ); $cfa816=d0d6b(); if(count($cfa816) > 0){ return $cfa816[0]; } else { return false; } } function mcca7($saad65,$lb4ca4,$p8f888=1){ global$_strings,$_config; $y7ffc4=($lb4ca4=='next')?'>':'<'; $m9b272=($lb4ca4=='next')?'':'DESC '; try { u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=". $p8f888 ." ". "AND `Stamp` ". $y7ffc4 ." '". $saad65['Stamp'] ."' ". w6f32(we852()). "ORDER BY STAMP ". $m9b272 . "LIMIT 1", 'get '. $lb4ca4 .' note' ); $cfa816=d0d6b(); if(count($cfa816) > 0) return $cfa816[0]; else return false; } catch (AeMySQLException $e){ b12f6($e,'Could not get '. $lb4ca4 .' note'); return null; } } function ua2d8($hddf82){ global$_config; if(Log::$ned2b5)__log('Lastmodifieds for Local Copier'); if(CACHE_LASTMODIFIEDS and is_file(CACHE_FILENAME_LASTMODIFIEDS)) { $s84636=@unserialize(file_get_contents(CACHE_FILENAME_LASTMODIFIEDS)); if ($s84636['ids_csv']==$hddf82){ if(Log::$ned2b5)__log('Returned from cache'); return $s84636['lastmodifieds_json']; } } $o56790='`ID`='. str_replace(',',' OR `ID`=',$hddf82); $eb7d96=array(); u0738( "SELECT `ID`, `LastModified` ". "FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (". $o56790 .")", 'get lastmodifieds for Local Copier' ); if(Log::$ned2b5)__log('Requested from DB'); $result=d0d6b(); foreach($result as $d8ce4b => $t9e366){ $eb7d96[(int)$t9e366['ID']] = (int)$t9e366['LastModified']; } $i08bb9=json_encode($eb7d96); if ($i08bb9=='[]')$i08bb9='{}'; $s84636=array ( 'ids_csv' => $hddf82, 'lastmodifieds_json' => $i08bb9, ); if(CACHE_LASTMODIFIEDS){ k6e52(CACHE_FILENAME_LASTMODIFIEDS,serialize($s84636)); } return $i08bb9; } function xd864($s8d777){ global$settings,$e71860,$_strings; $r7694f=$s8d777['query']; if (isset ($s8d777['page']) and $s8d777['page'] < 1) return e2_error404_mode(); $hd7e5d=$settings['appearance']['notes_per_page']; $db3b32=array(); $ifbb44=false; if (isset ($s8d777['page'])) { $e71860=$s8d777['page']; $r7694f.=' LIMIT '.($s8d777['page']-1)*$hd7e5d.', '.$hd7e5d; $p61e23=str_replace('SELECT *','SELECT count(*)',$s8d777['query']); u0738($p61e23,'count notes by criteria'); $result=d0d6b(); $ifbb44=$result[0]['count(*)']; $iae0fe=ceil($ifbb44/$hd7e5d); if ($e71860 > $iae0fe and $e71860!=1){ return e2_error404_mode(); } $db3b32['count']=$iae0fe; $db3b32['this']=$e71860; $db3b32['timeline?']=true; $db3b32['earlier-title']=$_strings['gs--earlier']; $db3b32['later-title']=$_strings['gs--later']; $o920fa=$s8d777['parameters']; if ($e71860 < $iae0fe){ $o920fa['page']=$e71860+1; $db3b32['earlier-href']=x83c8($s8d777['candy'],$o920fa); } if ($e71860 > 1){ $o920fa['page']=$e71860-1; $db3b32['later-href']=x83c8($s8d777['candy'],$o920fa); } } $z4358b=array(); u0738($r7694f,'get notes by criteria'); $result=$pe5b87=d0d6b(); if (@$s8d777['query-returns-only-ids']) { $result=array(); $o15514=we852(); foreach ($pe5b87 as $saad65){ $saad65=i4627($saad65['ID']); if ($saad65['IsPublished'] and yb44b($saad65,$o15514)) { $result[] = $saad65; } } } foreach($result as $d8ce4b => $saad65){ $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_ord']=$d8ce4b; $saad65['_']['_ord_max']=count($result)-1; $z4358b[] = o6791($saad65); } $l05a16=$z4358b; if (!isset ($s8d777['show-all-notes']) or @$s8d777['show-all-notes']!=true){ $l05a16=array_slice($z4358b,0,$hd7e5d); } if ($ifbb44===false)$ifbb44=count($l05a16); if (!count($z4358b) and array_key_exists('nothing',$s8d777)) { $r2cb9d['nothing']=$s8d777['nothing']; } $fcd0fd=array ( 'class', 'superheading', 'heading', 'title', 'search-related-tag', ); foreach ($fcd0fd as $af97bf){ if(array_key_exists($af97bf,$s8d777)) { $r2cb9d[$af97bf]=$s8d777[$af97bf]; } } if ($ifbb44){ $l5cde2=e2l_get_string( 'pt--n-posts', array ('number' => $ifbb44) ); } else { $l5cde2=$_strings['pt--no-posts']; } if(array_key_exists('maximum-notes',$s8d777) and $ifbb44 >= $s8d777['maximum-notes']) { $l5cde2=$_strings['gs--many-posts']; } foreach (array ('title','heading','superheading') as $e4b24c){ if(strstr($s8d777[$e4b24c],'%total%')) { $r2cb9d[$e4b24c]=str_replace('%total%', $l5cde2,$s8d777[$e4b24c]); } } $r2cb9d['notes']=$l05a16; $r2cb9d['pages']=$db3b32; return $r2cb9d; } function rf9fb($q41529,$t6f8f5,$r8277e=false){ global$_config; list ($b7b314,$wa1f20)=z5273($q41529,$t6f8f5,$r8277e); u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished` AND (`Stamp` BETWEEN " .$b7b314. " AND " .$wa1f20. ") ". "ORDER BY Stamp", 'get all notes for the date '. $r8277e .'.'. $t6f8f5 .'.'. $q41529 ); $result=d0d6b(); $ib1bc2=1; $r2cb9d=array(); foreach($result as $m65afd){ if(is_numeric($r8277e)) { $f3f917=((int)$q41529) .'/'. ((int)$t6f8f5) .'/'. ((int)$r8277e) == h5a2f('Y/n/j',$m65afd['Stamp'],l0923($m65afd)); } elseif(is_numeric($t6f8f5)) { $f3f917=((int)$q41529) .'/'. ((int)$t6f8f5) == h5a2f('Y/n',$m65afd['Stamp'],l0923($m65afd)); } else { $f3f917=((int)$q41529) == h5a2f('Y',$m65afd['Stamp'],l0923($m65afd)); } if ($f3f917){ if(is_numeric($r8277e)) { $m65afd['day_number']=$ib1bc2; } $r2cb9d[] = $m65afd; $ib1bc2 ++; } } return $r2cb9d; } function e2_published_noterec_with_parameters_($parameters=array ()) { $w39a37=e2_noterec_with_parameters_($parameters); if ($w39a37['IsPublished']) return $w39a37; } function e2_noterec_with_parameters_($parameters=array ()) { global$_config; $saad65=false; $nb5445=false; if ((string) @$parameters['oalias']!=='')$nb5445=$parameters['oalias']; if ((string)$nb5445!==''){ u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `OriginalAlias` = '". $nb5445 ."' ". "AND `IsPublished` = 0", 'get note record by original alias' ); $saad65=d0d6b(); if(count($saad65)==1) { $saad65=@$saad65[0]; if ($saad65) return $saad65; } } $d67e85=false; if (@$parameters['draft']!=='') $d67e85=$parameters['draft']; if (@$parameters['draft2']!=='')$d67e85=$parameters['draft2']; if ($d67e85){ $saad65=i4627($d67e85); return $saad65; } if ((string) @$parameters['alias']!==''){ if ($uc45dd=e2_aliasrec_of_alias_(@$parameters['alias'])) { if ($uc45dd['EntityType']==ENTITY_TYPE_NOTE){ $saad65=i4627($uc45dd['EntityID']); if ($saad65['IsPublished']) return $saad65; } } } $pc2d18=rf9fb($parameters['year'],$parameters['month'],$parameters['day']); if (@$pc2d18[$parameters['day-number']-1]) { return $pc2d18[$parameters['day-number']-1]; } } function qe56b($ld5d3d,$a1cb25,$mb2c6c,$hd19c2){ global$_config; le2f1(); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); $w39a37=array ( 'Title' => $ld5d3d, 'Text' => $a1cb25, 'FormatterID' => $_config['default_formatter'], 'OriginalAlias' => od712('find',ENTITY_TYPE_UNSPECIFIED,'',$ld5d3d), 'Uploads' => $hd19c2, 'Stamp' => (int)time(), 'LastModified' => (int)time(), ); if ($mb2c6c and is_array($mb2c6c)) { $w39a37['Offset'] = (int)$mb2c6c['offset']; $w39a37['IsDST'] = (int)$mb2c6c['is_dst']; } $w39a37=v9943('Notes',$w39a37); return $w39a37['ID']; } function d1630($rf2de2,$mb2c6c){ $hd17d3='/^ *(\d{1,2})\.(\d{1,2})\.(\d{2}|\d{4}) +(\d{1,2})\:(\d{1,2})\:(\d{1,2}) *$/'; if(preg_match($hd17d3,$rf2de2,$t6f8f5)) { $k96b8c=gmmktime($t6f8f5[4],$t6f8f5[5],$t6f8f5[6],$t6f8f5[2],$t6f8f5[1],$t6f8f5[3]); $k96b8c -= vb2bf($mb2c6c,$k96b8c); return $k96b8c; } else { return false; } } function na21e($z98ea6=''){ global$_fp_error,$_config,$_e2utf8__unformat_htmlentity_neasden,$_db; if(Log::$ned2b5)__log('Process note form'); try { $_fp_error=false; $y21158=$ld5d3d=$hd57ac=$a1cb25=$bb4960=''; if(array_key_exists('note-id',$_POST)) $y21158=$_POST['note-id']; if(array_key_exists('title',$_POST)) $ld5d3d=trim($_POST['title']); if(array_key_exists('tags',$_POST)) $hd57ac=$_POST['tags']; if(array_key_exists('text',$_POST)) $a1cb25=trim($_POST['text'],"\r\n"); if(array_key_exists('old-tags-hash',$_POST)) $bb4960=$_POST['old-tags-hash']; if(is_array($hd57ac))$hd57ac=implode(', ',$hd57ac); $hd57ac=trim($hd57ac); if ($y21158=='new'){ $_e2utf8__unformat_htmlentity_neasden=($_config['default_formatter']=='neasden'); } else { $_e2utf8__unformat_htmlentity_neasden=($_POST['formatter-id']=='neasden'); } $o73f92=m07e3('Notes'); if(stripos($o73f92['Collation'],'utf8mb4')!==0){ $ld5d3d=uff7c($ld5d3d); $hd57ac=uff7c($hd57ac); $a1cb25=uff7c($a1cb25,true); } $xffa71=$a1cb25; $xffa71=str_replace("\n",'\n'."\n",$xffa71); $xffa71=str_replace("\r",'\r'."\r",$xffa71); $xa6168=l163d(',',$hd57ac,'sort'); $hd57ac=implode(', ',$xa6168); $w65f31=md5($hd57ac); if(array_key_exists('browser-offset',$_POST)) { $mb2c6c=ja618(@$_POST['browser-offset']); } else { $mb2c6c=g5c05(); } $r02b37=@$_POST['old-stamp']; $iaddfe=@$_POST['stamp']; $k72487=@$_POST['alias']; if ($y21158!='new'){ $k383b7=i4627($y21158); } else { $k383b7=array(); } if ($y21158){ if ((string)$ld5d3d!=='' and (string)$a1cb25!==''){ if ($y21158=='new'){ $hd19c2=''; if(is_file(USER_FOLDER.'new-uploads.psa')) { $hd19c2=@file_get_contents(USER_FOLDER.'new-uploads.psa'); } try { $y21158=qe56b($ld5d3d,$a1cb25,$mb2c6c,$hd19c2); @unlink(USER_FOLDER.'new-uploads.psa'); $t33dd5='e2m_draft'; $q5ce5d=array ( '*note' => i4627($y21158), ); $w1fa03=[ 'success' => true, 'data' => [ 'status' => 'created', 'id' => $y21158, 'note-url' => x83c8($t33dd5,$q5ce5d), 'note-edit-url' => x83c8('e2m_note_edit',$q5ce5d) ] ]; $result=(int)$y21158; } catch (AeMySQLException $e){ b12f6($e,'Could not insert note'); $w1fa03=[ 'success' => false, 'error' => [ 'message' => 'Cannot create record' ] ]; $result=false; } } else { e2_drop_caches_for_note_($y21158); if (!$k383b7['IsPublished']) { @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); } $p71671=$k383b7; $p71671['ID']=$y21158; $p71671['Title']=$ld5d3d; $p71671['Text']=$a1cb25; $p71671['FormatterID']=$k383b7['FormatterID']; $p71671['LastModified']=time(); $p71671['IsIndexed']='1'; if ($r02b37!=$iaddfe){ if ($k96b8c=d1630($iaddfe,$mb2c6c)) { $p71671['Stamp']=min($k96b8c,time()); } else { unset ($k96b8c); } } $v17901=$k72487; if ((string)$k72487!==''){ $na7ff0=$k72487; } elseif (!$k383b7['IsPublished']) { $na7ff0=$ld5d3d; } else { $na7ff0=''; } if ($k383b7['IsPublished']) { $v17901=od712( 'set',ENTITY_TYPE_NOTE,$y21158,$na7ff0 ); $t33dd5='e2m_note'; $q5ce5d=array ( '*note' => $p71671, 'alias' => $v17901, ); } else { $x926c6=true; $v17901=od712('find',ENTITY_TYPE_NOTE,$y21158,$na7ff0); $p71671['OriginalAlias']=$v17901; $t33dd5='e2m_draft'; $q5ce5d=array ( '*note' => $p71671, 'alias' => $v17901, ); } $se449c=rc0c4( $p71671['FormatterID'],$p71671['Text'],'full' ); if(count($se449c) > 0){ t6be4($se449c); } try { qaa79('Notes',$p71671); if ($p71671['IsPublished']) { if (vd2e1($p71671)) { $p71671['IsIndexed']='1'; qaa79('Notes',$p71671); } b5b68($p71671); } $w1fa03=[ 'success' => true, 'data' => [ 'status' => 'saved', 'new-alias' => $v17901, 'note-url' => x83c8($t33dd5,$q5ce5d), 'note-edit-url' => x83c8('e2m_note_edit',$q5ce5d) ] ]; $result=(int)$y21158; } catch (AeMySQLException $e){ b12f6($e,'Could not update record'); $w1fa03=[ 'success' => false, 'error' => [ 'message' => 'Cannot update record ('. mysqli_error(). ')' ] ]; $result=false; } } if ($w65f31!=$bb4960){ a53f1(array ('NoteID' => $y21158)); foreach ($xa6168 as $le4d23){ $u70b77=n0188($le4d23); if (!$u70b77){ $u70b77['ID']=e03de($le4d23); } u0738( "INSERT INTO `". $_config['db_table_prefix']."NotesKeywords` ". "(`SubsetID`, `NoteID`, `KeywordID`) ". "VALUES (". ((int)$_config['db_table_subset']) .", ". ((int)$y21158) .", ". ((int)$u70b77['ID']). ")", 'add new tag bindings' ); } } if ( $z98ea6!='ajaxresult' and $result and $_POST['instant-publish']=='yes' ){ $_POST['note-id']=$y21158; e2s_note_publish(); } } else { $w1fa03=[ 'success' => false, 'error' => [ 'message' => 'Title or text is empty' ] ]; $_fp_error=FP_TITLE_OR_TEXT_EMPTY; $result=false; } } else { $w1fa03=[ 'success' => false, 'error' => [ 'message' => 'No note id/new specified' ] ]; $_fp_error=FP_NO_ID_OR_NEW; $result=false; } gcc38(x83c8('e2s_dump', array ())); } catch (AeMySQLException $e){ b12f6($e); $w1fa03=[ 'success' => false, 'error' => [ 'message' => 'Database error' ] ]; $result=false; } if ($z98ea6=='ajaxresult') return json_encode($w1fa03); else return$result; } function u3456($w1653c,$p0604c){ global$_config; if (!($w1653c and $p0604c) and !we852()) { if(Log::$ned2b5)__log('Error: e2_notes_count_generic called for invisible items unsecurely'); return null; } if (!is_bool($w1653c) or !is_bool($p0604c)) { if(Log::$ned2b5)__log ('Error: e2_notes_count_generic called with non-bool params'); return null; } if (!$w1653c and !$p0604c){ if(Log::$ned2b5)__log ('Error: e2_notes_count_generic called with nonsensical parameters'); return null; } $xd29bb=( CACHES_FOLDER . 'notes-count-p'. (int)$w1653c . ($w1653c ? ('v'. (int)$p0604c):'') . '.txt' ); $result=false; if(CACHE_NOTES_COUNTS and is_file($xd29bb)) { $result=@file_get_contents($xd29bb); } if(is_numeric($result) and $result > 0){ return$result; } else { $result=null; try { u0738( "SELECT COUNT(*) As NotesCount FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=". (int)$w1653c. " ". ($w1653c ? ( "AND `IsVisible`=". (int)$p0604c ):""), 'count notes with flags p'. (int)$w1653c . ($w1653c ? ('v'. (int)$p0604c):'') ); $result=d0d6b(); $result=$result[0]['NotesCount']; if(CACHE_NOTES_COUNTS)k6e52($xd29bb,$result); } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Could not count notes'); } return$result; } } function m5421($a1cb25){ $ya80da=$a1cb25; $ya80da=preg_match( '/^(\<\/div\>)?\<p( class\=\"lead\")?\>(.*)\<\/p\>$/m', $ya80da, $j9c28d ); $ya80da=$j9c28d[3]; if (!$ya80da)$ya80da=$a1cb25; $ya80da=str_replace(array ( '<p>','<blockquote>','<ul>','<ol>','<br />', ), "\n",$ya80da); $ya80da=trim(strip_tags($ya80da)); $w4d575=mb_strpos($ya80da,"\n"); if ($w4d575!==false){ $ya80da=mb_substr($ya80da,0,$w4d575); $ya80da=trim($ya80da,' :.()'."\n"); } if(preg_match('/^(.{100,}?)[:.!?()]|'."\n".'/s',$ya80da,$j9c28d)) { $ya80da=trim($j9c28d[0],' :.()'."\n"); } if(preg_match('/^(.{150,}?)[:.!?(),]/s',$ya80da,$j9c28d)) { $ya80da=trim($j9c28d[0],' :.()'."\n"); } if(preg_match('/^(.{200,}?)[:.!?(), ]/s',$ya80da,$j9c28d)) { $ya80da=trim($j9c28d[0],' :.()'."\n"); } if(in_array($ya80da[strlen($ya80da)-1], array (',',' '))) { $ya80da=trim($ya80da,', '). '...'; } if(mb_strlen($ya80da) > 250){ $ya80da=mb_substr($ya80da,0,250). '...'; } if(mb_substr($ya80da, -1)==='.')$ya80da=mb_substr($ya80da,0, -1); if(mb_substr($ya80da, -1)===':')$ya80da=mb_substr($ya80da,0, -1); if(mb_substr($ya80da, -1)==='!')$ya80da=mb_substr($ya80da,0, -1); return $ya80da; } function yb44b($w39a37,$o15514=false){ if ($o15514) return true; return $w39a37['IsVisible'] and $w39a37['Stamp'] <= time(); } function w6f32($o15514=false){ if ($o15514){ return ''; } else { return 'AND (n.`IsVisible` = 1 AND n.`Stamp` <= '. time() .') '; } } function e2_populate_read_counts_in_notes_ctree_($w6b12c){ global$_config; $zc6b5b=array(); foreach ($w6b12c as $d8ce4b => $ke244c){ if (@$ke244c['_']['_id']) { $zc6b5b[] = "(`EntityID` = ". $ke244c['_']['_id'].")"; } } if(count($zc6b5b)) { $zc6b5b=implode(' OR ',$zc6b5b); try { u0738( "SELECT `EntityID`, SUM(`ReadCount`) ReadCount ". "FROM `". $_config['db_table_prefix']."Actions` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (". $zc6b5b .") ". "GROUP BY `EntityID`", 'get read counts to populate notes CTree' ); $cfa816=d0d6b(); foreach ($cfa816 as $n33c9b){ $t0980a[$n33c9b['EntityID']] = $n33c9b['ReadCount']; } foreach ($w6b12c as $d8ce4b => $ke244c){ $w6b12c[$d8ce4b]['read-count']=$t0980a[$ke244c['_']['_id']]; } } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Could not populate read counts in notes ctree'); } } return $w6b12c; } define('DRAFT_PREVIEW_LENGTH',100); function e2m_drafts(){ global$_strings,$_config; if(Log::$ned2b5)__log('Drafts list: Working...'); $gda48a=null; if(CACHE_DRAFTS and is_file(CACHE_FILENAME_DRAFTS)) { $gda48a=@unserialize(file_get_contents(CACHE_FILENAME_DRAFTS)); } if(CACHE_DRAFTS and is_array($gda48a)) { if(Log::$ned2b5)__log('Drafts list: Retrieve cached ctree'); } else { if(Log::$ned2b5)__log('Drafts list: Assemle cacheable ctree...'); $gda48a=array(); if(Log::$ned2b5)__log('Drafts list: Select'); $x3f2a5=''; if($_config['limit_drafts']) { $x3f2a5="LIMIT ". ((int)$_config['limit_drafts']); } u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=0 ". "ORDER BY `SourceID` DESC, `LastModified` DESC ". $x3f2a5, 'get drafts to display on Drafts page' ); $result=d0d6b(); $z4358b=array(); foreach($result as $d8ce4b => $w39a37){ $saad65=array(); $saad65['_']['_id']=$w39a37['ID']; $saad65['_']['_ord']=$d8ce4b; $saad65['_']['_ord_max']=count($result)-1; $saad65['href']=x83c8('e2m_draft', array ('*note' => $w39a37)); $saad65['title']=u6f10(htmlspecialchars($w39a37['Title'],ENT_NOQUOTES,HSC_ENC)); if (isset ($saad65['image-href'])) unset ($saad65['image-href']); $w39a37['_']['_id']=$w39a37['ID']; $w39a37['_']['_ord']=0; $w39a37['_']['_ord_max']=0; $q8e4cd=o6791($w39a37,true); $saad65['_']['_resources']=null; if ($w39a37['FormatterID']=='neasden'){ $saad65['_']['_resources']=$q8e4cd['format-info']['resources-detected']; } elseif ($w39a37['FormatterID']=='calliope'){ $saad65['_']['_resources']=rc0c4( $w39a37['FormatterID'],$w39a37['Text'],'full' ); } $saad65=array_merge($saad65,q1a48($w39a37,false)); $saad65['text-fragment']=strip_tags($q8e4cd['text']); $c2ab2d=false; if(mb_strlen($saad65['text-fragment']) > DRAFT_PREVIEW_LENGTH) { $c2ab2d=mb_strpos($saad65['text-fragment'],'.',DRAFT_PREVIEW_LENGTH); } if ($c2ab2d!==false){ $saad65['text-fragment']=mb_substr($saad65['text-fragment'],0,$c2ab2d+1); } $gda48a[] = $saad65; } if(CACHE_DRAFTS)k6e52(CACHE_FILENAME_DRAFTS,serialize($gda48a)); } if(Log::$ned2b5)__log('Drafts list: Put thumbnail without cache'); if ($gda48a){ foreach ($gda48a as $d8ce4b => $t9e366){ $gda48a[$d8ce4b]['thumbs']=b2e82(@$t9e366['_']['_resources']); } } if(Log::$ned2b5)__log('Drafts list: Done'); $r2cb9d=array ( 'title' => $_strings['pt--drafts'], 'heading' => $_strings['pt--drafts'], ); if(count($gda48a)) { $r2cb9d['drafts']=$gda48a; } else { $r2cb9d['nothing']=$_strings['gs--no-drafts']; } return $r2cb9d; } function e2m_draft($parameters=array ()) { global$_strings,$_config,$x57de2; $saad65=$parameters['*note']; if (!$saad65 or $saad65['IsPublished']) { $parameters['alias']=$parameters['oalias']; unset($parameters['oalias']); $saad65=e2_noterec_with_parameters_($parameters); if ($saad65){ $gd58c0=x83c8('e2m_note', array ('*note' => $saad65)); return e2_go_to($gd58c0); } } if (!$saad65) return e2_error404_mode(); $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_ord']=0; $saad65['_']['_ord_max']=0; $q8e4cd=o6791($saad65); $k45513=array ( '.note-id' => $saad65['ID'], 'form-action' => x83c8('e2s_note_publish'), 'submit-text' => $_strings['fb--publish-draft'], 'can-schedule?' => false, 'can-publish?' => !@$_config['read_only'], ); return array ( 'title' => $saad65['Title'].' ('. $_strings['wd--draft'] .')', 'notes' => array ('only' => $q8e4cd), 'form' => 'form-note-publish', 'form-note-publish' => $k45513, ); } function e2m_draft_preview($parameters=array ()) { return e2_error404_mode(); } function e2_draft_alias_use_count($w176fe){ global$_config; if(Log::$ned2b5)__log('Drafts: find duplicate OriginalAliases...'); if(CACHE_DRAFTS_ALIAS_USE_COUNTS and is_file(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS)) { $rda552=@unserialize(file_get_contents(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS)); } if(CACHE_DRAFTS_ALIAS_USE_COUNTS and is_array($rda552)) { if(Log::$ned2b5)__log('Drafts: retrieve cached'); } else { if(Log::$ned2b5)__log('Drafts: assemle cacheable...'); $rda552=array(); u0738( "SELECT `OriginalAlias` FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=0 ". "ORDER BY `ID`", 'get original aliases of drafts to calculate use counts' ); $result=d0d6b(); $z4358b=array(); foreach($result as $d8ce4b => $w39a37){ @$rda552[$w39a37['OriginalAlias']] ++; } if(CACHE_DRAFTS_ALIAS_USE_COUNTS){ k6e52(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS,serialize($rda552)); } } return $rda552[$w176fe]; } function e2drafts__preview_key($saad65){ return md5($saad65['Text'].$saad65['LastModified']); } function h29a1(){ global$_strings,$_user_folder_name; $ceccd7='http://'. $_strings['e2--website-host'] .'/'; $x68966='('. $_strings['e2--release'] .' '. E2_RELEASE .', v'. E2_VERSION .')'; return [ 'built?' => BUILT, 'installed?' => (n2ac5()!==null), 'version' => 'v'. E2_VERSION, 'version-description' => $_strings['e2--vname-aegea'] .' '. $x68966, 'user-folder-name' => $_user_folder_name, 'cookie-prefix' => v8c3b(), 'href' => $ceccd7, 'about' => ( '<span title="E2 '.$x68966 .'">'. $_strings['e2--powered-by'] .' '. '<a href="'. $ceccd7 .'" class="nu"><u>'. $_strings['e2--vname-aegea'] .'</u>'. '<span class="e2-svgi">'. kf42c('aegea') .'</span></a></span>' ), ]; } function rc4da($uc48ba,$w6b12c,$o89650,$gcadc1,$he22d5){ global$full_blog_url,$content, $_config, $_candies_indexable, $_candies_indexable_conditionally, $_template, $_newsfeeds, $_current_url; $meta['base-href']=$full_blog_url. '/'; $meta['current-href']=$_current_url; $meta['stylesheets']=l37ca(); $meta['scripts']=o4753(); $meta['newsfeeds']=$_newsfeeds; $meta['favicon-type']='image/x-icon'; $meta['favicon-href']='favicon.ico'; if ($ra01d9=f2461()) { $meta['favicon-type']=oc952($ra01d9); $meta['favicon-href']=$ra01d9; $meta['apple-touch-icon-href']=f2461('square'); } $meta['navigation-links'] = [[ 'rel' => 'index', 'href' => x83c8('e2m_frontpage', ['page' => 1]), 'id' => 'link-index', ]]; if (!empty ($he22d5)) { foreach (['prev','next','earlier','later'] as $mc47d1){ if(array_key_exists($mc47d1 .'-href',$he22d5)) { $y7ffc4=$mc47d1; if ($mc47d1=='earlier')$y7ffc4='prev'; if ($mc47d1=='later')$y7ffc4='next'; $meta['navigation-links'][] = [ 'rel' => $y7ffc4, 'href' => $he22d5[$mc47d1 .'-href'], 'id' => 'link-'. $mc47d1, ]; } } } $c1e2ad='noindex, follow'; if (@$_config['index_follow_everything']) { $c1e2ad='index, follow'; } if(in_array($uc48ba,$_candies_indexable)) { $meta['robots']='index, follow'; } if(in_array($uc48ba,$_candies_indexable_conditionally)) { $meta['robots']=$c1e2ad; } $meta['viewport']=$_template['meta_viewport']; if(is_file(MEDIA_ROOT_FOLDER.'manifest.json')) { $meta['manifest-href']=$full_blog_url. '/manifest.json'; } $meta['og-images'] = array (); if(is_array($w6b12c['only']['og-images'])) { $meta['og-images']=$w6b12c['only']['og-images']; $meta['twitter-card']='summary_large_image'; } if(is_array($o89650['og-images'])) { $meta['og-images']=$o89650['og-images']; $meta['twitter-card']='summary_large_image'; } if (!count($meta['og-images'])) { $meta['og-images'] = array ($gcadc1['userpic-large-href']); $meta['twitter-card']='summary'; } return$meta; } function o5e47(){ global$_superconfig,$_config; $u34a31=[ 'new-note-href' => x83c8('e2m_write'), 'drafts-href' => x83c8('e2m_drafts'), 'drafts-count' => (int)u3456(false,true), 'settings-href' => x83c8('e2m_settings'), 'theme-preview-href' => x83c8('e2m_theme_preview', array ('theme' => '')), 'password-href' => x83c8('e2m_password', array ('recovery-key' => '')), 'database-href' => x83c8('e2m_database'), 'timezone-href' => x83c8('e2m_timezone'), 'sessions-href' => x83c8('e2m_sessions'), 'sign-out-href' => x83c8('e2m_sign_out'), ]; if (rda67()) { $u34a31['get-backup-href']=x83c8('e2m_get_backup'); } if (@$_config['read_only']) { unset ($u34a31['new-note-href']); unset ($u34a31['settings-href']); unset ($u34a31['timezone-href']); } if (@$_superconfig['disallow_themes_preview']) { unset ($u34a31['theme-preview-href']); } if (@$_superconfig['disallow_db_config']) { unset ($u34a31['database-href']); } list ($mfe9e2,$w85ee4,$j20699)=v2a6b(); if ($mfe9e2){ $u34a31['new-comments-count']=$mfe9e2; $u34a31['new-comments-href']=$j20699; } return $u34a31; } function e2m_tags(){ global$_strings; $r2cb9d['title']=$_strings['pt--tags']; $r2cb9d['heading']=$_strings['pt--tags']; $r2cb9d['tags']=ie531([]); $ecd342=ubb5b(true); if ($ecd342===null){ $r2cb9d['unavailable?']=true; } else { $r2cb9d['tags']['each']=$ecd342; if(count($ecd342)==0){ $r2cb9d['nothing']=$_strings['gs--no-tags']; } } return $r2cb9d; } function e2m_tag($parameters=array ()) { global $settings, $_config, $_current_tag, $_strings, $e71860, $full_blog_url; if(Log::$ned2b5)__log('Tag {'); if(array_key_exists('*tags',$parameters)) { $l59aeb=$parameters['*tags']; } if (!$l59aeb[0]) return e2_error404_mode(); $qd7df5=$l59aeb[0]; $e7186e=$parameters['tag-alias']; if(count($l59aeb)==1){ $_current_tag=$qd7df5['Keyword']; } $e71860=$parameters['page']; $gc2b7b=$_config['db_table_prefix']; $hd7e5d=$settings['appearance']['notes_per_page']; foreach ($l59aeb as $t9e366) if ($t9e366){ $o56790[] = "nk.KeywordID=". $t9e366['ID']; } $o56790='('.implode(' OR ',$o56790).')'; $o15514=we852(); $o56790.='AND IsPublished=1 '; $o56790.=w6f32($o15514); $i9b0c2=count($l59aeb); $v7a86c=($e71860-1)*$hd7e5d; $maa9f7=$hd7e5d; $lac5c7=( "SELECT SQL_CALC_FOUND_ROWS n.*, COUNT(*) ". "FROM `". $gc2b7b ."Notes` n ". "JOIN `". $gc2b7b ."NotesKeywords` nk ON nk.`NoteID` = n.`ID` ". "WHERE n.`SubsetID`=". $_config['db_table_subset'] ." ". "AND nk.`SubsetID`=". $_config['db_table_subset'] ." ". "AND ". $o56790 . "GROUP BY n.ID ". "HAVING COUNT(*)>=". $i9b0c2 ." ". "ORDER BY n.`Stamp` DESC ". "LIMIT ". $v7a86c .", ". $maa9f7 ); u0738($lac5c7); $result=d0d6b(); u0738("SELECT FOUND_ROWS() AS cnt"); $e67363=d0d6b(); $ifbb44=$e67363 ? (int)$e67363[0]['cnt']:0; $db3b32=array(); if ($ifbb44){ $iae0fe=ceil($ifbb44/$hd7e5d); $db3b32['timeline?']=true; $db3b32['count']=$iae0fe; $db3b32['this']=$e71860; $db3b32['earlier-title']=$_strings['gs--earlier']; $db3b32['later-title']=$_strings['gs--later']; $o920fa=$parameters; if ($e71860 < $iae0fe){ $o920fa['page']=$e71860+1; $db3b32['earlier-href']=x83c8('e2m_tag',$o920fa); } if ($e71860 > 1){ $o920fa['page']=$e71860-1; $db3b32['later-href']=x83c8('e2m_tag',$o920fa); } } if ($e71860 > $iae0fe){ return e2_error404_mode(); } if ($ifbb44==0){ if (!$o15514){ return e2_error404_mode(); } if ($e71860!=1){ return e2_error404_mode(); } } $z4358b=[]; foreach($result as $d8ce4b => $saad65){ $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_ord']=$d8ce4b; $saad65['_']['_ord_max']=count($result)-1; $z4358b[] = o6791($saad65); } if ($i9b0c2==1){ if ($o15514){ $n97a59['edit-href']=x83c8( 'e2m_tag_edit', array ('tag-alias' => $e7186e) ); } if ((string)$qd7df5['Description']!==''){ $o2bfe4=bb7f1($qd7df5['Description'],'full'); $f67daf=$o2bfe4['text-final']; $n97a59['description']=$f67daf; $n97a59['description-format-info']=$o2bfe4['meta']; a57ad(@$o2bfe4['meta']['links-required']); } $w3ad42=x83c8('e2m_tag_rss', array ('tag-alias' => $e7186e)); $w9d19f=x83c8('e2m_tag_json', array ('tag-alias' => $e7186e)); q3010( 'rss', n6f51() .': '. $qd7df5['Keyword'], $w3ad42 ); q3010( 'json', n6f51() .': '. $qd7df5['Keyword'], $w9d19f ); $n97a59['og-images']=tdbcc( 'tag',$qd7df5['ID'], $n97a59['description-format-info']['resources-detected'] ); } $y96963=( e2l_get_string('pt--n-posts', array ('number' => $ifbb44)). ' '. $_strings['gs--tagged'] ); $p8235e=array(); foreach ($l59aeb as $t9e366){ $p8235e[] = htmlspecialchars($t9e366['Keyword'],ENT_COMPAT,HSC_ENC); } $p8235e=implode(', ',$p8235e); $wb73b1=htmlspecialchars($qd7df5['PageTitle'],ENT_COMPAT,HSC_ENC); if ((string)$wb73b1!==''){ $ld5d3d=$wb73b1; $hd6b14=$y96963 .' '. $p8235e; $cf74f5=$wb73b1; } else { $ld5d3d=n6f51() .': '. $y96963 .' '. $p8235e; $hd6b14=$y96963; $cf74f5=$p8235e; } $r2cb9d=array ( 'title' => $ld5d3d, 'superheading' => $hd6b14, 'heading' => $cf74f5, 'pages' => $db3b32, 'notes' => $z4358b, 'tags' => ie531($parameters), ); if ($f67daf){ $r2cb9d['summary']=m5421($f67daf); } if(count($l59aeb)==1){ $r2cb9d['tag']=$n97a59; if (we852()) { $r2cb9d['related-edit-href']=$n97a59['edit-href']; $r2cb9d['related-edit-title']=$_strings['tt--edit-tag']; } } if(Log::$ned2b5)__log('} // Tag'); return $r2cb9d; } function e2m_tag_edit($parameters=array()) { global$_strings; if(array_key_exists('*tag',$parameters)) { $qd7df5=$parameters['*tag']; } if (!$qd7df5) return e2_error404_mode(); $se449c=rc0c4( 'neasden',$qd7df5['Description'],'full' ); $t75e1b=hf898( 'tag',$qd7df5['ID'],$se449c ); t2f83( 'Keywords', $qd7df5, $se449c ); $hc999b=yd10e(); $z480ee=[ 'enabled?' => x1363($hc999b), 'each' => $t75e1b, 'upload-action' => x83c8('e2j_file_upload'), 'remove-action' => x83c8('e2j_file_remove'), ]; $rcd831=array ( '.tag-id' => $qd7df5['ID'], '.formatter-id' => 'neasden', 'form-action' => x83c8('e2s_tag_edit'), 'submit-text' => $_strings['fb--save-changes'], 'tag' => htmlspecialchars($qd7df5['Keyword'],ENT_COMPAT,HSC_ENC), 'page-title' => htmlspecialchars($qd7df5['PageTitle'],ENT_COMPAT,HSC_ENC), 'page-title-placeholder' => htmlspecialchars($qd7df5['Keyword'],ENT_COMPAT,HSC_ENC), 'urlname' => htmlspecialchars($parameters['tag-alias'],ENT_COMPAT,HSC_ENC), 'description' => htmlspecialchars($qd7df5['Description'],ENT_COMPAT,HSC_ENC), 'favourite?' => (bool)$qd7df5['IsFavourite'], 'space-usage' => zaf64($hc999b), ); $rcd831['.cache-sensitive-hash']=md5( $rcd831['tag'] . $rcd831['uploads'] . $rcd831['urlname'] ); $r2cb9d=array ( 'body-uploads-enabled?' => x1363($hc999b), 'title' => $_strings['pt--tag-edit'] .': '. $qd7df5['Keyword'], 'heading' => $_strings['pt--tag-edit'], 'form' => 'form-tag', 'form-tag' => $rcd831, 'uploads' => $z480ee, 'related-delete-href' => x83c8('e2m_tag_delete', array ('*tag' => $qd7df5)), ); return $r2cb9d; } function e2m_tag_flag_ajax($parameters){ r705b([ 'flag-name' => 'tag', 'candy-name' => 'e2m_tag_flag_ajax', 'parameters' => $parameters, 'flipping-function' => function () use ($parameters){ y2e88($parameters); }, ]); } function y2e88($parameters){ if(array_key_exists('*tag',$parameters)) { $qd7df5=$parameters['*tag']; } if (!$qd7df5) return e2_error404_mode(); @unlink(CACHE_FILENAME_FAVTAGS); @unlink(CACHE_FILENAME_TAGS); @unlink(CACHE_FILENAME_TAGS_FULL); @unlink(CACHE_FILENAME_TAGS_AUTHOR); @unlink(CACHE_FILENAME_TAGS_AUTHOR_FULL); qaa79('Keywords', array ( 'ID' => $qd7df5['ID'], $parameters['flag'] => (int) ($parameters['value']==1), )); return true; } function e2m_tag_delete($parameters=array()) { global$_strings; if(array_key_exists('*tag',$parameters)) { $qd7df5=$parameters['*tag']; } if (!$qd7df5) return e2_error404_mode(); $decc14=array ( '.tag-id' => $qd7df5['ID'], 'caution-text' => e2l_get_string('gs--tag-will-be-deleted-notes-remain', array ( 'tag' => htmlspecialchars($qd7df5['Keyword'],ENT_COMPAT,HSC_ENC) )), 'tag' => htmlspecialchars($qd7df5['Keyword'],ENT_COMPAT,HSC_ENC), 'form-action' => x83c8('e2s_tag_delete'), 'submit-text' => $_strings['fb--delete'], ); $r2cb9d=array ( 'title' => $_strings['pt--tag-delete'] .': '. $qd7df5['Keyword'], 'heading' => $_strings['pt--tag-delete'], 'form' => 'form-tag-delete', 'form-tag-delete' => $decc14, ); return $r2cb9d; } function e2m_untagged(){ global$_strings,$_config; return xd864(array ( 'query' => "SELECT n.* FROM `". $_config['db_table_prefix']."Notes` n ". "LEFT OUTER JOIN `". $_config['db_table_prefix']."NotesKeywords` nk ". "ON nk.`NoteID` = n.`ID` ". "WHERE n.`SubsetID`=". $_config['db_table_subset'] ." ". "AND nk.`SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". "AND nk.`KeywordID` IS NULL ". w6f32(we852()). "ORDER BY n.`Stamp` DESC", 'title' => $_strings['pt--posts-without-tags'], 'heading' => $_strings['pt--posts-without-tags'], 'nothing' => $_strings['gs--no-posts-without-tags'], 'show-all-notes' => true, )); return $r2cb9d; } function e2s_tag_edit(){ global$_strings,$_config; $s76f09=$le4d23=$f67daf=$na7ff0=''; if(array_key_exists('tag-id',$_POST)) $s76f09=$_POST['tag-id']; if(array_key_exists('tag',$_POST)) $le4d23=$_POST['tag']; if(array_key_exists('page-title',$_POST)) $wb73b1=trim($_POST['page-title'],"\r\n"); if(array_key_exists('description',$_POST)) $f67daf=trim($_POST['description'],"\r\n"); if(array_key_exists('urlname',$_POST)) $na7ff0=trim($_POST['urlname'],"\r\n"); if(array_key_exists('cache-sensitive-hash',$_POST)) { $m3c58b=$_POST['cache-sensitive-hash']; $qbb9a8=md5($le4d23.$na7ff0); } $o73f92=m07e3('Notes'); if(stripos($o73f92['Collation'],'utf8mb4')!==0){ $le4d23=uff7c($le4d23); $wb73b1=uff7c($wb73b1); $f67daf=uff7c($f67daf,true); } u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = ".((int)$s76f09)."", 'get tag record to update' ); $b53e61=d0d6b(); if(count($b53e61)!=1) die; $rb19ad=$b53e61[0]; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `Keyword` = '". a7928($le4d23) ."' ". "AND (`ID` != ".((int)$s76f09).")", 'make sure new tag name does not conflict with existing ones' ); $b53e61=d0d6b(); if(count($b53e61)==0){ if ($qbb9a8!=$m3c58b){ i7996(); } @unlink(CACHE_FILENAME_FAVTAGS); @unlink(CACHE_FILENAME_TAGS); @unlink(CACHE_FILENAME_TAGS_FULL); @unlink(CACHE_FILENAME_TAGS_AUTHOR); @unlink(CACHE_FILENAME_TAGS_AUTHOR_FULL); $rb19ad['ID'] = ((int)$s76f09); $rb19ad['Keyword']=$le4d23; $rb19ad['PageTitle']=$wb73b1; $rb19ad['Description']=$f67daf; qaa79('Keywords',$rb19ad); $v17901=od712( 'set',ENTITY_TYPE_TAG,$rb19ad['ID'],$na7ff0 ); e2_go_to(x83c8('e2m_tag', array ('tag-alias' => $v17901))); } else { q8a40($_strings['er--cannot-rename-tag'],E2E_USER_ERROR); j4930(); } die; } function e2s_tag_delete(){ global$_strings,$_config; $xb80bb=((int)$_POST['tag-id']); i7996(); @unlink(CACHE_FILENAME_FAVTAGS); @unlink(CACHE_FILENAME_TAGS); @unlink(CACHE_FILENAME_TAGS_FULL); @unlink(CACHE_FILENAME_TAGS_AUTHOR); @unlink(CACHE_FILENAME_TAGS_AUTHOR_FULL); u0738( "DELETE FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $xb80bb ); u0738( "DELETE FROM `". $_config['db_table_prefix']."NotesKeywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `KeywordID`=". $xb80bb ); e2_go_to(x83c8('e2m_tags')); die; } function faf16($e07f25){ global$_current_tag,$_config; $m9df9d=null; if(CACHE_FAVTAGS and is_file(CACHE_FILENAME_FAVTAGS)) { $m9df9d=@unserialize(file_get_contents(CACHE_FILENAME_FAVTAGS)); } if (!is_array($m9df9d)) { try { u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND IsFavourite = 1 ORDER BY `Keyword`", 'get favorite tags for tags menu' ); $h9cdff=d0d6b(); $m9df9d=array(); foreach ($h9cdff as $b04ff0){ $vc6827['tag']=htmlspecialchars($b04ff0['Keyword'],ENT_NOQUOTES,HSC_ENC); $vc6827['href']=x83c8( 'e2m_tag', array ('*tag' => $b04ff0) ); $m9df9d[] = $vc6827; } if(CACHE_FAVTAGS)k6e52(CACHE_FILENAME_FAVTAGS,serialize($m9df9d)); } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Count not get tags menu from database'); } } if (!is_array($m9df9d)) return null; $d8a4f1=false; foreach ($m9df9d as $d8ce4b => $t9e366){ $m9df9d[$d8ce4b]['current?'] = ( $m9df9d[$d8ce4b]['tag']==$_current_tag ); if ($m9df9d[$d8ce4b]['current?']) { $d8a4f1=true; $f08187=$e07f25; $f08187['flag']='IsFavourite'; $f08187['value']=0; if (we852()) { $m9df9d[$d8ce4b]['pinnable?']=true; $m9df9d[$d8ce4b]['pinned?']=true; $m9df9d[$d8ce4b]['pinned-toggle-href'] = ( x83c8('e2m_tag_flag_ajax',$f08187) ); } } } if (we852()) { if (!$d8a4f1 and array_key_exists('*tag',$e07f25)) { $ua55a9=$e07f25; $ua55a9['flag']='IsFavourite'; $ua55a9['value']=1; $nd5a7a=array ( 'tag' => htmlspecialchars($e07f25['*tag']['Keyword'],ENT_NOQUOTES,HSC_ENC), 'href' => x83c8('e2m_tag',$e07f25), 'current?' => true, 'pinnable?' => true, 'pinned?' => false, 'pinned-toggle-href' => x83c8('e2m_tag_flag_ajax',$ua55a9), ); $m9df9d[] = $nd5a7a; } } return $m9df9d; } function ace23($y21158){ global$_config; $c0dff3=array(); u0738( "SELECT k.* ". "FROM `". $_config['db_table_prefix']."Keywords` k, ". "`". $_config['db_table_prefix']."NotesKeywords` nk ". "WHERE k.`SubsetID`=". $_config['db_table_subset'] ." ". "AND nk.`SubsetID`=". $_config['db_table_subset'] ." ". "AND nk.`NoteID`=". ((int)$y21158) ." ". "AND k.`ID`=nk.`KeywordID` ". "ORDER BY `Keyword`", 'get tag records for note by id' ); $c0dff3=d0d6b(); return $c0dff3; } function a53f1($geaa60){ global$_config; $j316e8=array(); foreach (array ( 'ID', 'NoteID', 'KeywordID', ) as $s06e3d) if(array_key_exists($s06e3d,$geaa60)) { $w6a7f2[] = '`'. $s06e3d .'`'."='". a7928($geaa60[$s06e3d]) ."'"; if ($s06e3d=='ID')$t729d6='tagbinging-id'; if ($s06e3d=='NoteID')$t729d6='tagbinging-note-id'; if ($s06e3d=='KeywordID')$t729d6='tagbinging-tag-id'; $j316e8[$t729d6]=$geaa60[$s06e3d]; } $b1b1cc=( "DELETE FROM `". $_config['db_table_prefix']."NotesKeywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND ". implode(' AND ',$w6a7f2) ); u0738($b1b1cc); } function e03de($le4d23){ @unlink(CACHE_FILENAME_TAGS); @unlink(CACHE_FILENAME_TAGS_FULL); @unlink(CACHE_FILENAME_TAGS_AUTHOR); @unlink(CACHE_FILENAME_TAGS_AUTHOR_FULL); $rb19ad=array ( 'Keyword' => $le4d23, 'OriginalAlias' => od712('find',ENTITY_TYPE_UNSPECIFIED,'',$le4d23), 'Description' => '', ); $rb19ad=v9943('Keywords',$rb19ad); $z419a1=od712( 'set',ENTITY_TYPE_TAG,$rb19ad['ID'],$le4d23 ); if ($z419a1!=$rb19ad['OriginalAlias']) { $rb19ad['OriginalAlias']=$z419a1; qaa79('Keywords',$rb19ad); } return $rb19ad['ID']; } function ie531($parameters){ if (($o933dd=ubb5b()) === null) return []; $oc6ce7['each']=$o933dd; if(count($oc6ce7['each']) > 0){ $oc6ce7['href']=x83c8('e2m_tags'); } if (($nbd876=faf16($parameters)) !== null){ $oc6ce7['menu-each']=$nbd876; } return $oc6ce7; } function ubb5b($oe9dc9=false){ global$_config; $o15514=we852(); $xd29bb=CACHE_FILENAME_TAGS; if ($o15514)$xd29bb=CACHE_FILENAME_TAGS_AUTHOR; if ($oe9dc9){ $xd29bb=CACHE_FILENAME_TAGS_FULL; if ($o15514)$xd29bb=CACHE_FILENAME_TAGS_AUTHOR_FULL; } $k8da94=null; if(CACHE_TAGS and is_file($xd29bb)) { $k8da94=@unserialize(file_get_contents($xd29bb)); } if (!is_array($k8da94)) { try { u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "ORDER BY `Keyword`", 'get all tags' ); $z35016=array(); foreach (d0d6b() as $rb19ad){ $le4d23['tag']=htmlspecialchars($rb19ad['Keyword'],ENT_NOQUOTES,HSC_ENC); $le4d23['favourite?'] = (bool)$rb19ad['IsFavourite']; $le4d23['notes-count']=0; $le4d23['last-used']=0; $le4d23['freshness']=0; $le4d23['weight']=0; if ($oe9dc9){ $le4d23['href']=x83c8('e2m_tag', array ('*tag' => $rb19ad)); } $z35016[$rb19ad['ID']] = $le4d23; } u0738( "SELECT nk.KeywordID, COUNT(DISTINCT n.ID) as Count, max(n.Stamp) as LastUsed ". "FROM `". $_config['db_table_prefix']."NotesKeywords` nk, ". "`". $_config['db_table_prefix']."Notes` n ". "WHERE nk.`SubsetID`=". $_config['db_table_subset'] ." ". "AND n.`SubsetID`=". $_config['db_table_subset'] ." ". "AND n.`IsPublished` = 1 ". w6f32($o15514). "AND nk.`NoteID` = n.`ID` ". "GROUP BY nk.KeywordID", 'get tags ordering info' ); $b9fdd5=0; $e8f57c=0; $a06894=0; foreach (d0d6b() as $l28a42){ $vc6827 =& $z35016[$l28a42['KeywordID']]; $vc6827['notes-count']=$l28a42['Count']; if (@$vc6827['last-used'] < $l28a42['LastUsed']) { $vc6827['last-used']=$l28a42['LastUsed']; $e452b4=(time()-$vc6827['last-used']) / SECONDS_IN_A_YEAR; $vc6827['freshness']=pow(1/2,$e452b4); } $b9fdd5=max($b9fdd5,$vc6827['notes-count']); $e8f57c=max($e8f57c,$vc6827['freshness']); $a06894=max($a06894,$vc6827['notes-count']*$vc6827['freshness']); } $k8da94=array(); foreach ($z35016 as $f865c0 => $t9e366){ if (!$o15514 and $t9e366['notes-count']==0) continue; $p95e80=mb_strtolower($t9e366['tag']); $k8da94[$p95e80]=$t9e366; if ($e8f57c!=0){ $k8da94[$p95e80]['freshness']=$t9e366['freshness']/$e8f57c; } else { $k8da94[$p95e80]['freshness']=0; } if ($a06894!=0){ $k8da94[$p95e80]['weight'] = ( $t9e366['freshness']*$t9e366['notes-count']/$a06894 ); } else { $k8da94[$p95e80]['weight']=0; } if ($k8da94[$p95e80]['favourite?'])$k8da94[$p95e80]['weight']=1; } if(CACHE_TAGS)k6e52($xd29bb,serialize($k8da94)); } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Could not get tags from database'); } } return $k8da94; } function n0188($qd7df5){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `Keyword`='". a7928($qd7df5) ."'", 'get tag by name' ); $d8ce4b=d0d6b(); if (isset ($d8ce4b[0])) { return $d8ce4b[0]; } else { return null; } } function c8770($bd7ca3){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `OriginalAlias`='".a7928($bd7ca3)."'", 'get tag by legacy urlname name' ); $cfa816=d0d6b(); if (isset ($cfa816[0])) { return $cfa816[0]; } else { return null; } } function h4e28($xb80bb){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`='".((int)$xb80bb)."'", 'get tag by id' ); $cfa816=d0d6b(); if (isset ($cfa816[0])) { return $cfa816[0]; } else { return null; } } function e2_tagrecs_with_parameters_($parameters){ $ubdcf3=array(); if (@$parameters['tag-alias'] or $parameters['tag-alias']==='0'){ $ubdcf3=explode(',',$parameters['tag-alias']); } $c0dff3=array(); foreach ($ubdcf3 as $bd7ca3) if ($bd7ca3 or $bd7ca3==='0'){ if ( $uc45dd=e2_aliasrec_of_alias_(@$bd7ca3) and ($uc45dd['EntityType']==ENTITY_TYPE_TAG) and ($rb19ad=h4e28($uc45dd['EntityID'])) ) { $c0dff3[] = $rb19ad; } else { if ($q3ee3f=c8770($bd7ca3)) { $c0dff3[] = $q3ee3f; } } } return $c0dff3; } function s2e04(){ global$full_blog_url; static $o0d5f1; $b3c6e0=i7874(); if (empty ($o0d5f1)) { $o0d5f1=md5($full_blog_url .'email'. $b3c6e0); } return $o0d5f1; } function gd8c5(){ global$full_blog_url; static $l05fa8; $b3c6e0=i7874(); if (empty ($l05fa8)) { $l05fa8=md5($full_blog_url .'nospam'. $b3c6e0.date('n-Y')); } return $l05fa8; } function ce7ec(){ global$full_blog_url; static $d6f410; $b3c6e0=i7874(); if(empty($d6f410)) { $d6f410=md5($full_blog_url .'nospam'. $b3c6e0.date('n-Y',strtotime('-1 month'))); } return $d6f410; } function n41f3($y21158){ global$full_blog_url; $b3c6e0=i7874(); return v8c3b('comment_'. md5($full_blog_url .'nospam_cookie'. $b3c6e0.$y21158)); } function q7c9d(){ global$full_blog_url; $q83647=$_SERVER['HTTP_USER_AGENT']; $b3c6e0=i7874(); return md5($full_blog_url .'nospam_cookie'. $b3c6e0.$q83647); } function web9a(){ if ( array_key_exists('email',$_POST) and $_POST['email']!=='' ) return true; $l05fa8=gd8c5(); $d6f410=ce7ec(); if ( !array_key_exists($l05fa8,$_POST) and !array_key_exists($d6f410,$_POST) ) return true; if ( ( array_key_exists($l05fa8,$_POST) and $_POST[$l05fa8]!=='' ) or ( array_key_exists($d6f410,$_POST) and $_POST[$d6f410]!=='' ) ) return true; if ( !array_key_exists('comment',$_POST) or (strlen($_POST['comment']) > 6) ) return true; return false; } function e2_cookie_data_is_spam_suspicios_for_note_id_($y21158){ if ( !array_key_exists(n41f3($y21158),$_COOKIE) or ($_COOKIE[n41f3($y21158)] !== q7c9d()) ) return true; return false; } function e2m_comment($parameters=array ()) { e2_go_to(x83c8('e2m_note',$parameters)); die; } function e2m_comment_edit($parameters=array ()) { return q4fb7('edit',$parameters); } function q4fb7($p60cd8,$parameters=array ()) { global$_config,$_strings,$full_blog_url; $ld5d3d=$cf74f5=$_strings['pt--new-comment']; $c69b97='new'; if ($p60cd8=='edit'){ $l4032b=e2_commentrec_with_parameters_($parameters); $sc50d0=$_strings['fb--save-changes']; $w39a37=$l4032b['noterec']; $ld5d3d=$cf74f5=$_strings['pt--edit-comment']; $b1aec6=f86f8($w39a37,$l4032b,$parameters['comment-number']); $c69b97=$naca8d['ID']; if (!$l4032b){ return e2_error404_mode(); } $b80f02=array ( '.note-id' => $l4032b['NoteID'], '.comment-id' => $l4032b['ID'], '.comment-number' => $parameters['comment-number'], '.already-subscribed?' => false, '.gip' => $l4032b['GIP'], '.from' => substr($_SERVER['HTTP_REFERER'],strlen($full_blog_url)+1), 'create:edit?' => false, 'form-action' => x83c8('e2s_comment_process'), 'submit-text' => $sc50d0, 'show-subscribe?' => true, 'subscribe?' => (bool)$l4032b['IsSubscriber'], 'name' => htmlspecialchars($l4032b['AuthorName'],ENT_COMPAT,HSC_ENC), 'email' => htmlspecialchars($l4032b['AuthorEmail'],ENT_COMPAT,HSC_ENC), 'text' => htmlspecialchars($l4032b['Text'],ENT_COMPAT,HSC_ENC), 'email-field-name' => s2e04(), ); if (''!=trim($l4032b['IP'])) { $b80f02['ip']=$l4032b['IP']; } } $r2cb9d=array ( 'title' => $ld5d3d, 'heading' => $cf74f5, 'form' => 'form-comment', 'form-comment' => $b80f02, ); if (!empty ($b1aec6)) { $r2cb9d['comments'] = array ('each' => array ('only' => $b1aec6)); } return $r2cb9d; } function e2m_comment_reply($parameters=array ()) { global$_strings; $l4032b=e2_commentrec_with_parameters_($parameters); if (!$l4032b){ return e2_error404_mode(); } $w39a37=$l4032b['noterec']; $b1aec6=f86f8($w39a37,$l4032b,$parameters['comment-number']); $b1aec6['_']['_id']=$l4032b['ID']; $b1aec6['_']['_ord']=0; $b1aec6['_']['_ord_max']=0; $b1aec6['replying?'] = (bool)true; $r817c7=($l4032b['Reply']=='' or !$l4032b['IsReplyVisible']); $ld5d3d=$r817c7? $_strings['pt--reply-to-comment']:$_strings['pt--edit-reply-to-comment']; $s4dc70=array ( '.note-id' => $w39a37['ID'], '.comment-id' => $l4032b['ID'], '.reply-action' => $r817c7? 'new':'edit', 'form-action' => x83c8('e2s_comment_edit_reply'), 'submit-text' => $r817c7? $_strings['fb--publish']:$_strings['fb--save-changes'], 'create:edit?' => (bool) ($r817c7), 'reply-text' => htmlspecialchars($l4032b['Reply'],ENT_COMPAT,HSC_ENC), 'mail-back?' => (bool) ($r817c7), ); return array ( 'title' => $ld5d3d, 'heading' => $ld5d3d, 'comments' => array ('each' => array ('only' => $b1aec6)), 'form' => 'form-comment-reply', 'form-comment-reply' => $s4dc70, ); } function e2m_comment_delete($parameters=array ()) { global$_strings,$settings,$qcbcce,$_config; $l4032b=e2_commentrec_with_parameters_($parameters); $y21158=$l4032b['NoteID']; if (!$l4032b){ return e2_error404_mode(); } e2_drop_caches_for_note_($y21158); @unlink(USER_FOLDER. '/last-comment.psa'); u0738( "DELETE FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". ((int)$l4032b['ID']). "'" ); j4930(); die; } function e2m_comment_reply_delete($parameters=array ()) { global$_strings,$settings,$_config; $l4032b=e2_commentrec_with_parameters_($parameters); if (!$l4032b){ return e2_error404_mode(); } u0738( "UPDATE `". $_config['db_table_prefix']."Comments` SET ". "`Reply`='', ". "`IsReplyFavourite`='0' ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=".((int)$l4032b['ID']) ); j4930(); die; } function e2m_unsubscribe($parameters){ global$_strings,$_config; $d70a17="ORDER BY `ID` DESC"; $q260ca=false; $w39a37=$parameters['*note']; $y21158=$w39a37['ID']; $a0c83f=$parameters['unsubscribe-email']; $b1bc29=$parameters['unsubscribe-key']; $a0c83f=str_replace(' ','+',$a0c83f); if ($y21158){ u0738( "SELECT `ID`, `Stamp` FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". $y21158 ." ". "AND `IsSubscriber`=1 ". "AND `AuthorEmail`='". $a0c83f ."' ". $d70a17, 'get subscribers comments ids' ); $result=d0d6b(); if(count($result) < 1) { $r2cb9d['unsubscribe']['error-message']=$_strings['gs--you-are-not-subscribed']; } else { $z06d4c=@$result[0]; $e97f69=md5($z06d4c['ID'].$z06d4c['Stamp'] .'x'); if ($b1bc29==$e97f69){ u0738( "UPDATE `". $_config['db_table_prefix']."Comments` ". "SET `IsSubscriber`=0 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". $y21158 ." ". "AND `AuthorEmail` = '". a7928($a0c83f). "'", 'unsubscribe' ); $q260ca=true; $r2cb9d['unsubscribe']['note-title']=u6f10( htmlspecialchars($w39a37['Title'],ENT_COMPAT,HSC_ENC) ); $r2cb9d['unsubscribe']['note-href']=x83c8( 'e2m_note', array ('*note' => $w39a37) ); } if (!$q260ca){ $r2cb9d['unsubscribe']['error-message']=$_strings['gs--unsubscription-didnt-work']; } } } else { $r2cb9d['unsubscribe']['error-message']=$_strings['gs--post-not-found']; } if ($q260ca){ $ld5d3d=$_strings['pt--unsubscription-done']; } else { $ld5d3d=$_strings['pt--unsubscription-failed']; } $r2cb9d['unsubscribe']['success?']=$q260ca; $r2cb9d['title']=$ld5d3d; $r2cb9d['heading']=$ld5d3d; return $r2cb9d; } function e2m_comment_flag($parameters){ k6e30($parameters); e2_go_to(x83c8('e2m_note',$parameters)); die; } function e2m_comment_flag_ajax($parameters){ r705b([ 'flag-name' => 'comment', 'candy-name' => 'e2m_comment_flag_ajax', 'parameters' => $parameters, 'flipping-function' => function () use ($parameters){ k6e30($parameters); }, ]); } function k6e30($parameters){ $l4032b=e2_commentrec_with_parameters_($parameters); $y21158=$l4032b['NoteID']; if ($l4032b){ qaa79('Comments', array ( 'ID' => $l4032b['ID'], $parameters['flag'] => (int) ($parameters['value']==1), )); e2_drop_caches_for_note_($y21158); } } function e2s_comment_process(){ global$_strings,$_fp_error; list ($y21158,$c69b97,$x9d090)=s1a90(); if(Log::$ned2b5)__log('Comments: processed, noteid <'. $y21158 .'>, commentid <'. $c69b97 .'>'); if (!$c69b97){ $s05c36=''; if($_fp_error==FP_NOT_COMMENTABLE){ q8a40($_strings['er--post-not-commentable'],E2E_USER_ERROR); } elseif($_fp_error==FP_EMPTY_FIELD){ q8a40($_strings['er--name-email-text-required'],E2E_USER_ERROR); } elseif($_fp_error==FP_COMMENT_TOO_LONG){ $faa731=$_strings['gs--comment-too-long']; $s05c36=$_strings['gs--comment-too-long-description']; } elseif($_fp_error==FP_COMMENT_DOUBLE_POST){ $faa731=$_strings['gs--comment-double-post']; $s05c36=$_strings['gs--comment-double-post-description']; } elseif($_fp_error==FP_COMMENT_SPAM_SUSPECT){ $faa731=$_strings['gs--comment-spam-suspect']; $s05c36=$_strings['gs--comment-spam-suspect-description']; } else { q8a40($_strings['er--error-occurred'].' ('. $_fp_error .')'); } if ($s05c36){ $r2cb9d['title']=$faa731; $r2cb9d['heading']=$faa731; $r2cb9d['form']='form-unaccepted-comment'; $r2cb9d['form-unaccepted-comment'] = array ( 'reason' => $s05c36, 'text' => @htmlspecialchars($x9d090['text'],ENT_COMPAT,HSC_ENC), ); return $r2cb9d; } } if ($y21158){ e2_go_to(x83c8('e2m_note', array ('*note' => i4627($y21158)))); } else { e2_go_to(); } die; } function e2s_comment_edit_reply(){ global$_strings,$x57de2,$_config; $ae84af=@$_POST['text']; if(trim($ae84af)=='')$ae84af=''; $y21158=@$_POST['note-id']; $saad65=i4627($y21158); $c69b97=@$_POST['comment-id']; $z06d4c=q0d27($c69b97); $g54eb6=isset ($_POST['mail-back']); $k54fa9=time(); if (@$_POST['reply-action']=='new'){ $ue0e30=time(); } @unlink(e2_note_cache_filename_with_id_($y21158 .'-comments')); @unlink(e2_note_cache_filename_with_id_($y21158 .'-comments-author')); if ($z06d4c){ u0738( "UPDATE `". $_config['db_table_prefix']."Comments` SET ". "`Reply`='". a7928($ae84af) ."', ". ( isset ($ue0e30)? ( "`ReplyStamp`='". $ue0e30 ."', " ) : ( "" ) ). "`ReplyLastModified`='". $k54fa9 ."', ". "`IsReplyVisible`='1' ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=".((int)$c69b97), 'update comment reply' ); $gd58c0=x83c8('e2m_note', array ('*note' => $saad65)); if ($g54eb6 and $ae84af!=''){ $vc6827['comment-time'] = array ($z06d4c['Stamp'],g5c05()); $vc6827['commenter']=$z06d4c['AuthorName']; $vc6827['commenter-email']=$z06d4c['AuthorEmail']; $vc6827['comment-text']=$z06d4c['Text']; $vc6827['note-title']=u6f10($saad65['Title']); $vc6827['reply-time'] = array (time(),g5c05()); $vc6827['blog-author']=k2640(); $vc6827['note-href']=$gd58c0; $vc6827['comment-href']=$gd58c0; $vc6827['reply-text']=$ae84af; if(1){ $ade7a3=n3e5c( 'comment-reply',$vc6827 ); $lb904c=e2l_get_string( 'em--comment-reply', $vc6827 ); $k77613=$z06d4c['AuthorEmail']; $q1a49b='From: '. daed2(); fa41b($k77613,$lb904c,$ade7a3,$q1a49b); } if(1){ unset ($vc6827['commenter-email']); $q1a49b='From: '. daed2(); foreach (pd225($saad65,$z06d4c['AuthorEmail']) as $x39c63){ $aba570=$x39c63['AuthorEmail']; $h6fd85=md5($x39c63['ID'].$x39c63['Stamp'].'x'); $vc6827['unsubscribe-href']=x83c8('e2m_unsubscribe', array ( '*note' => $saad65, 'unsubscribe-email' => $aba570, 'unsubscribe-key' => $h6fd85, ) ); $k77613=$aba570; $ade7a3=n3e5c('comment-reply-to-public',$vc6827); $lb904c=e2l_get_string( 'em--comment-reply-to-public-subject', $vc6827 ); fa41b($k77613,$lb904c,$ade7a3,$q1a49b); } } } e2_go_to($gd58c0); } else { j4930(); } die; } function f86f8($saad65,$z06d4c,$ib1bc2){ global$_config,$full_blog_url; if(Log::$ned2b5)__log('Package comment '. $z06d4c['ID'] .'...'); if ($saad65===null){ $saad65=i4627($z06d4c['NoteID']); } $vc6827['number']=$ib1bc2; $a7b397=!empty ($z06d4c['IsGIPUsed']); $vc6827['gip-used?']=$a7b397; $vc6827['gip']=$vc6827['gip-used?']?$z06d4c['GIP']:''; $vc6827['name']=htmlspecialchars($z06d4c['AuthorName'],ENT_NOQUOTES,HSC_ENC); $vc6827['userpic-set?']=false; if ($a7b397){ $r51c69=AVATARS_FOLDER.$z06d4c['GIP'] .'-'. $z06d4c['GIPAuthorID'] .'.jpg'; if(is_file(MEDIA_ROOT_FOLDER.$r51c69)) { $vc6827['userpic-set?']=true; $vc6827['userpic-href']=$full_blog_url .'/'. $r51c69; } } $vc6827['name-href']=''; if ( $a7b397 and $z020fc=e2_get_user_profile_url($z06d4c['GIP'],$z06d4c['GIPAuthorID'],$z06d4c['AuthorProfileLink']) ) { $vc6827['name-href']=$z020fc; } if (we852()) { $vc6827['email']=htmlspecialchars($z06d4c['AuthorEmail'],ENT_NOQUOTES,HSC_ENC); if (''!=trim($z06d4c['IP'])) { $vc6827['ip']=$z06d4c['IP']; } } $vc6827['author-name']=k2640(); $vc6827['important?'] = (bool)$z06d4c['IsFavourite']; $vc6827['reply-visible?'] = (bool) ($z06d4c['IsVisible'] && $z06d4c['IsReplyVisible']); $vc6827['reply-important?'] = (bool)$z06d4c['IsReplyFavourite']; $vc6827['spam-suspect?'] = (bool)$z06d4c['IsSpamSuspect']; $v10a7e=array ((int)$z06d4c['Stamp'],l0923($saad65)); $vc6827['time']=$v10a7e; $vc6827['last-modified']=$v10a7e; if ($z06d4c['LastModified']) $vc6827['last-modified'] = array ((int)$z06d4c['LastModified'],l0923($saad65)); if ($z06d4c['ReplyStamp']) $vc6827['reply-time'] = array ((int)$z06d4c['ReplyStamp'],l0923($saad65)); if ($z06d4c['ReplyLastModified']) $vc6827['reply-last-modified'] = array ((int)$z06d4c['ReplyLastModified'],l0923($saad65)); if (we852()) { $vc6827['subscriber?'] = (bool)$z06d4c['IsSubscriber']; $vc6827['new?'] = (bool)$z06d4c['IsNew']; $vc6827['first-new?']=false; if (!@$_config['read_only']) { if ($z06d4c['IsFavourite']) { $vc6827['important-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ('*note' => $saad65,'comment-number' => $ib1bc2,'flag' => 'IsFavourite','value' => 0) ); } else { $vc6827['important-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ('*note' => $saad65,'comment-number' => $ib1bc2,'flag' => 'IsFavourite','value' => 1) ); } if ($z06d4c['IsReplyFavourite']) { $vc6827['reply-important-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2,'flag' => 'IsReplyFavourite','value' => 0 ) ); } else { $vc6827['reply-important-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2,'flag' => 'IsReplyFavourite','value' => 1 ) ); } $vc6827['edit-href']=x83c8( 'e2m_comment_edit', array ('*note' => $saad65,'comment-number' => $ib1bc2) ); $vc6827['removed-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsVisible','value' => !$z06d4c['IsVisible'] ) ); $vc6827['removed-reply-toggle-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsReplyVisible','value' => !$z06d4c['IsVisible'] ) ); $vc6827['removed-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsVisible','value' => 0 ) ); $vc6827['removed-reply-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsReplyVisible','value' => 0 ) ); $vc6827['replaced-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsVisible','value' => 1 ) ); $vc6827['replaced-reply-href']=x83c8( 'e2m_comment_flag_ajax', array ( '*note' => $saad65,'comment-number' => $ib1bc2, 'flag' => 'IsReplyVisible','value' => 1 ) ); $we36ef=x83c8( 'e2m_comment_reply', array ('*note' => $saad65,'comment-number' => $ib1bc2) ); if ($z06d4c['Reply']=='' or !$z06d4c['IsReplyVisible']) { $vc6827['reply-href']=$we36ef; } else { $vc6827['edit-reply-href']=$we36ef; } } } if(mb_strlen($z06d4c['Text']) > $_config['max_comment_length']) { $z06d4c['Text']=mb_substr($z06d4c['Text'],0,$_config['max_comment_length']); } $ub64b8=$saad65['FormatterID']==='raw'?'neasden':$saad65['FormatterID']; $o2bfe4=j154e($ub64b8,$z06d4c['Text'],'simple'); $vc6827['text']=$o2bfe4['text-final']; $vc6827['reply']=''; $vc6827['replying?'] = (bool)false; $vc6827['replied?'] = (bool) ( (trim($z06d4c['Reply']) != '') && ($z06d4c['IsReplyVisible']) ); if ((string)$z06d4c['Reply']!==''){ $o2bfe4=j154e($saad65['FormatterID'],$z06d4c['Reply'],'full'); $vc6827['reply']=$o2bfe4['text-final']; } if(array_key_exists('_',$z06d4c))$vc6827['_']=$z06d4c['_']; if(Log::$ned2b5)__log('Comments: done'); return $vc6827; } function q0d27($xb80bb){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". $xb80bb ."'" ); $cfa816=d0d6b(); if(count($cfa816) > 0){ return $cfa816[0]; } else { return false; } } function le5b6($p0604c){ e2_comment_set_flag('IsVisible',$p0604c); } function u3183($l0dd2c){ e2_comment_set_flag('IsReplyVisible',$l0dd2c); } function f66aa($oea59a){ global$_strings,$_config,$settings; $ye3cb9=@$_COOKIE[v8c3b('commenter_name')]; $yf92ee=@$_COOKIE[v8c3b('commenter_email')]; $c3d682=@$_COOKIE[v8c3b('commenter_ph')]; $p92399=false; if ($yf92ee and $c3d682){ foreach (pd225($oea59a) as $x39c63){ $e97f69=md5($x39c63['ID'].$x39c63['Stamp'] .'x'); if ( $x39c63['AuthorEmail']==$yf92ee and $c3d682==$e97f69 ){ $p92399=true; break; } } } $sc50d0=$_strings['fb--submit']; $l05fa8=gd8c5(); $b80f02=array ( '.note-id' => $oea59a['ID'], '.comment-id' => 'new', '.already-subscribed?' => (bool)$p92399, 'cookie-name' => n41f3($oea59a['ID']), 'cookie-value' => q7c9d(), 'email-field-name' => s2e04(), 'nospam-field-name-part-1' => substr($l05fa8,0,4), 'nospam-field-name-part-2' => substr($l05fa8,4), 'create:edit?' => true, 'form-action' => x83c8('e2s_comment_process'), 'submit-text' => $sc50d0, 'show-subscribe?' => (bool) !$p92399, 'subscribe?' => (bool)$p92399, 'subscription-status' => $p92399? $_strings['gs--you-are-already-subscribed']:'', 'name' => htmlspecialchars($ye3cb9,ENT_COMPAT,HSC_ENC), 'email' => htmlspecialchars($yf92ee,ENT_COMPAT,HSC_ENC), 'text' => htmlspecialchars($z06d4c['Text'],ENT_COMPAT,HSC_ENC), 'email-comments-enabled?' => empty ($settings['comments']['require_gip']), 'gips' => array (), ); $w73ce1=false; $mafda1=''; foreach(e2_list_gips() as $z48e15){ if (!is_file(SYSTEM_FOLDER .'gips/'. $z48e15 .'.json')) { continue; } $r2ce07=e2_is_logged_in($z48e15); $b80f02['gips'][$z48e15] = ( e2_get_gip_auth_url($z48e15) ); if ($r2ce07){ $w73ce1=true; $ja64f4=e2_get_gip_session($z48e15); $mafda1=$ja64f4['GIP']; $b80f02['name']=htmlspecialchars( $ja64f4['AuthorName'],ENT_COMPAT,HSC_ENC ); } } if (!$b80f02['email-comments-enabled?'] and !count($b80f02['gips'])) { return false; } $b80f02['email-comments-only?'] = (count($b80f02['gips']) === 0); $b80f02['logged-in?']=$w73ce1; $b80f02['logged-in-gip']=$mafda1; $b80f02['logout-url']=$w73ce1?x83c8('e2m_gip_sign_out', array('provider' => E2GIP::get_logout_key())) : ''; return $b80f02; } function i3ce7($y21158){ return nb23e($y21158,'`IsNew` = 1'); } function v254f($y21158){ return nb23e($y21158,'`IsVisible` = 1'); } function nb23e($y21158,$o56790){ global$_config; if (!is_numeric($y21158)) return 0; $jbc751=0; u0738( "SELECT count(*) ". "FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". $y21158 ." ". "AND (". $o56790. ")", 'count comments' ); $result=d0d6b(); $result=(int)$result[0]['count(*)']; $jbc751=$result; return (int)$jbc751; } function v2a6b(){ global$_config; if(Log::$ned2b5)__log('Count new comments'); $xe2942=0; $f7ec7e=''; $xe8fab=''; try { u0738( "SELECT `NoteID`, `Text` FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsNew`=1 ORDER BY `Stamp`", 'count new comments for author menu' ); $result=d0d6b(); $xe2942=count($result); if ($xe2942){ $y21158=$result[0]['NoteID']; $xe8fab=x83c8( 'e2m_note', array ('*note' => i4627($y21158)) ); } } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Could not count new comments or provide link to the latest one'); } return array ((int)$xe2942,$f7ec7e,$xe8fab); } function n70a7($y21158){ global$_config; if(Log::$ned2b5)__log('Comments: getting comments for note '. $y21158); u0738( "SELECT * FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". @$y21158." ". "ORDER BY `Stamp`", 'get comments including deleted' ); $result=d0d6b(); return$result; } function pd225($saad65,$rd1cc6=''){ global$_config; $d70a17="ORDER BY `ID` DESC"; $r2cb9d=$vaf67c=[]; u0738( "SELECT DISTINCT `ID`, `Text`, `IsSubscriber`, `IsVisible`, ". "`AuthorName`, `AuthorEmail`, `Stamp` ". "FROM `". $_config['db_table_prefix']."Comments` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `NoteID`=". @$saad65['ID'] ." ". "AND `IsSubscriber`=1 ". "AND `IsVisible`=1 ". "AND `AuthorEmail`!='". a7928($rd1cc6) ."' ". $d70a17, 'get subscribers by note' ); $result=d0d6b(); foreach($result as $x39c63){ if (!in_array($x39c63['AuthorEmail'],$vaf67c)) { $r2cb9d[] = $x39c63; } $vaf67c[] = $x39c63['AuthorEmail']; } return $r2cb9d; } function gb387($saad65,$f3f917=NOTE_COMMENTABLE_NOW){ global$settings,$_config; $mbdb20=true; if (@$settings['comments']['fresh_only']) if (isset ($_config['comment_freshness_days'])) if ($saad65['Stamp'] < time()-$_config['comment_freshness_days']*SECONDS_IN_A_DAY) $mbdb20=false; $tc770a=$saad65['IsCommentable']; if ($f3f917==NOTE_COMMENTABLE_NOW_CONDITIONALLY){ $tc770a=true; } return ( $saad65['IsPublished'] and yb44b($saad65) and $mbdb20 and $tc770a ); } function e2_commentrec_with_parameters_($parameters=array ()) { $w39a37=$parameters['*note']; $na5d49=n70a7($w39a37['ID']); $l4032b=@$na5d49[$parameters['comment-number']-1]; if ($l4032b){ $l4032b['noterec']=$w39a37; return $l4032b; } } function s1a90($z98ea6=''){ global$settings,$qcbcce,$_config,$_fp_error; $_fp_error=false; $o0d5f1=s2e04(); $y21158=$c69b97=$vb0689=$a0c83f=$a1cb25=''; if(array_key_exists('note-id',$_POST)) $y21158=trim(@$_POST['note-id']); if(array_key_exists('comment-id',$_POST)) $c69b97=trim(@$_POST['comment-id']); if(array_key_exists('comment-number',$_POST)) $ib1bc2=trim(@$_POST['comment-number']); if(array_key_exists('name',$_POST)) $vb0689=trim(@$_POST['name']); if(array_key_exists($o0d5f1,$_POST)) $a0c83f=trim(@$_POST[$o0d5f1]); if(array_key_exists('text',$_POST)) $a1cb25=trim(@$_POST['text']); $qe3a2d=m07e3('Comments'); if(stripos($qe3a2d['Collation'],'utf8mb4')!==0){ $vb0689=uff7c($vb0689); $a1cb25=uff7c($a1cb25); } if ($c69b97=='new'){ $k396a4=e2_get_logged_gip_name(); if ($k396a4){ $ja64f4=e2_get_gip_session($k396a4); $vb0689=trim($ja64f4['AuthorName']); $a0c83f=''; $idec42=$ja64f4['GIPAuthorID']; } } else { if(array_key_exists('gip',$_POST))$k396a4=trim(@$_POST['gip']); } $q07d3d=( (array_key_exists('already-subscribed',$_POST) and $_POST['already-subscribed']) or (array_key_exists('subscribe',$_POST) and $_POST['subscribe']) ); $u20612=time(); $x9d090['text']=$a1cb25; if ($c69b97=='new' and !$k396a4){ ic64a('commenter_name',$vb0689); ic64a('commenter_email',$a0c83f); } $n848b5=($c69b97=='new' and ( web9a() or e2_cookie_data_is_spam_suspicios_for_note_id_($y21158) )); $lc2b1a=1; $result=false; if (!is_numeric($y21158)) { $_fp_error=FP_NO_ID_OR_NEW; } elseif (!is_numeric($c69b97) and !($c69b97=='new')) { $_fp_error=FP_NO_ID_OR_NEW; } else { if ( $a1cb25=='' or ( !$k396a4 and ($vb0689=='' or $a0c83f=='') ) ) { $_fp_error=FP_EMPTY_FIELD; } if ($c69b97=='new'){ $y795f1=@unserialize(file_get_contents(USER_FOLDER. '/last-comment.psa')); if(md5($vb0689.$a0c83f.$a1cb25)==$y795f1['md5']) { $_fp_error=FP_COMMENT_DOUBLE_POST; } if ( isset ($_config['max_comment_length']) and strlen(@$_POST['text']) > ($_config['max_comment_length']) ){ $_fp_error=FP_COMMENT_TOO_LONG; } $w39a37=i4627($y21158); if ($c69b97=='new' and !gb387($w39a37)) { $_fp_error=FP_NOT_COMMENTABLE; } if ($n848b5){ $_fp_error=FP_COMMENT_SPAM_SUSPECT; } } } if (!$_fp_error){ e2_drop_caches_for_note_($y21158); if ($c69b97=='new'){ $l4032b=array ( 'NoteID' => (int)$y21158, 'AuthorName' => $vb0689, 'AuthorEmail' => $a0c83f, 'Text' => $a1cb25, 'Reply' => '', 'IsVisible' => 1, 'IsAnswerAware' => 1, 'IsSubscriber' => (int)$q07d3d, 'IsSpamSuspect' => (int)$n848b5, 'IsNew' => (int)$lc2b1a, 'Stamp' => (int)time(), 'LastModified' => (int)time(), 'IP' => a7928(p1668()), 'IsGIPUsed' => intval(!empty ($k396a4) && !empty ($idec42)), 'GIP' => !empty ($k396a4)?a7928($k396a4):'', 'GIPAuthorID' => !empty ($idec42)?a7928($idec42):'', ); $l4032b=v9943('Comments',$l4032b); $c69b97=$l4032b['ID']; $y795f1=array ( 'id' => $c69b97, 'md5' => md5($vb0689.$a0c83f.$a1cb25), ); @k6e52(USER_FOLDER. 'last-comment.psa',serialize($y795f1)); $result=(int)$c69b97; $h303ee=md5($l4032b['ID'].$l4032b['Stamp'].'x'); ic64a('commenter_ph',$h303ee); $saad65=i4627($y21158); $gd58c0=x83c8('e2m_note', array ('*note' => $saad65)); $vc6827['comment-time'] = array ($u20612,g5c05()); $vc6827['commenter']=$vb0689; $vc6827['commenter-email']=$a0c83f; $vc6827['comment-text']=$a1cb25; $vc6827['note-title']=$saad65['Title']; $vc6827['note-href']=$gd58c0; $vc6827['comment-href']=$gd58c0; $vc6827['comments-disable-href']=x83c8('e2m_note_flag', array ( '*note' => $saad65, 'flag' => 'IsCommentable', 'value' => 0 )); $vc6827['reply-href']=x83c8( 'e2m_comment_reply', array ( '*note' => $saad65, 'comment-number' => $ib1bc2 ) ); if (isset ($settings['user']['email']) and @$settings['notifications']['new_comments']) { $ade7a3=n3e5c( 'comment-new-to-author',$vc6827 ); $lb904c=e2l_get_string( 'em--comment-new-to-author-subject', $vc6827 ); $k77613=$settings['user']['email']; $q1a49b = 'From: '. daed2() ."\r\n". 'Reply-to: '. $vb0689 .' <'. $a0c83f .">"; fa41b($k77613,$lb904c,$ade7a3,$q1a49b); } if (!$n848b5){ unset ($vc6827['commenter-email']); $q1a49b='From: '. daed2(); foreach (pd225($saad65,$a0c83f) as $x39c63){ $aba570=$x39c63['AuthorEmail']; $h6fd85=md5($x39c63['ID'].$x39c63['Stamp'].'x'); $vc6827['unsubscribe-href']=x83c8('e2m_unsubscribe', array ( '*note' => $saad65, 'unsubscribe-email' => $aba570, 'unsubscribe-key' => $h6fd85 ) ); $k77613=$aba570; $ade7a3=n3e5c('comment-new-to-public',$vc6827); $lb904c=e2l_get_string( 'em--comment-new-to-public-subject', $vc6827 ); fa41b($k77613,$lb904c,$ade7a3,$q1a49b); } } } else { $ffd6f3=array ( 'ID' => $c69b97, 'Text' => $a1cb25, 'IsSubscriber' => ((int)$q07d3d), 'LastModified' => time(), ); if (!empty ($vb0689))$ffd6f3['AuthorName']=$vb0689; if (!empty ($a0c83f))$ffd6f3['AuthorEmail']=$a0c83f; qaa79('Comments',$ffd6f3); $result=(int)$c69b97; } } if ($z98ea6=='ajaxresult') return $w1fa03; else return array ((int)$y21158,$result,$x9d090); } function e2m_most_commented(){ global$settings,$_strings,$_config; $za0acf=@$_GET['period']; if ($za0acf=='')$za0acf=$_config['hot_period']; $u632a2=time()-f35c3($za0acf); return xd864(array ( 'query' => "SELECT `IsVisible`, `Stamp`, `NoteID` ID, count(*) quantity ". "FROM `". $_config['db_table_prefix']."Comments` c ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND (`Stamp` > ". $u632a2.") ". "AND c.`IsVisible` = 1 ". "GROUP BY ID ". "ORDER BY quantity ". "DESC ". "LIMIT ".$settings['appearance']['notes_per_page'], 'query-returns-only-ids' => 1, 'limit' => $settings['appearance']['notes_per_page'], 'title' => e2l_get_string('pt--most-commented', array ('period' => $za0acf)), 'heading' => e2l_get_string('pt--most-commented', array ('period' => $za0acf)), 'nothing' => $_strings['gs--no-such-notes'], )); } function e2m_favourites($parameters=array ()) { global$_config,$_strings; return xd864(array ( 'query' => "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 AND `IsFavourite`=1 ". w6f32(we852()). "ORDER BY `Stamp` DESC", 'page' => $parameters['page'], 'candy' => 'e2m_favourites', 'parameters' => $parameters, 'title' => $_strings['pt--favourites'], 'heading' => $_strings['pt--favourites'], 'nothing' => $_strings['gs--no-favourites'], )); } function f35c3($za0acf){ if ('year'==$za0acf) return SECONDS_IN_A_YEAR; elseif ('month'==$za0acf) return SECONDS_IN_A_MONTH; elseif ('week'==$za0acf) return SECONDS_IN_A_DAY*7; elseif ('day'==$za0acf) return SECONDS_IN_A_DAY; else return PHP_INT_MAX; } function h8696($s8d777){ global$_current_url; if(Log::$ned2b5)__log('Arbitrary list ('. $s8d777['_log'] .') {'); $of4ac8=null; if ($s8d777['cache'] and is_file($s8d777['cache-filename'])) { $of4ac8=@unserialize(file_get_contents($s8d777['cache-filename'])); } $tf957e=true; if ($s8d777['cache-filename-expires']) { if ($s8d777['cache'] and is_file($s8d777['cache-filename-expires'])) { $g07cc6=time(); $k09bcb=(int) @file_get_contents($s8d777['cache-filename-expires']); if(Log::$ned2b5)__log('List expires '. date('r',$k09bcb) .', now '. date('r',$g07cc6)); $tf957e=($g07cc6 < $k09bcb); } } $udbb0c=array(); if ($s8d777['cache'] and is_array($of4ac8) and $tf957e){ if(Log::$ned2b5)__log('Retrieve cached ctree'); $udbb0c=$of4ac8; } else { if(Log::$ned2b5)__log('Assemle cacheable ctree...'); $z4358b=array(); try { u0738( $s8d777['query'], 'get "'. $s8d777['_log'] .'" list' ); $result=d0d6b(); foreach($result as $d8ce4b => $w39a37){ $w39a37=i4627($w39a37['ID']); if (yb44b($w39a37) and $w39a37['IsPublished']) { $saad65['_']['_id']=$w39a37['ID']; $saad65['_']['_ord']=$d8ce4b; $saad65['_']['_ord_max']=count($result)-1; $saad65['href']=x83c8('e2m_note', array ('*note' => $w39a37)); $saad65['time'] = array ($w39a37['Stamp'],l0923($w39a37)); $saad65['title']=u6f10(htmlspecialchars($w39a37['Title'],ENT_NOQUOTES,HSC_ENC)); $udbb0c[] = $saad65; } } $of4ac8=$udbb0c; if ($s8d777['cache']) { @k6e52($s8d777['cache-filename'],serialize($of4ac8)); if ($s8d777['cache-filename-expires']) { @k6e52($s8d777['cache-filename-expires'],time()+$s8d777['expires-after']); } } } catch (AeMySQLException $e){ b12f6($e); if(Log::$ned2b5)__log('Could not get arbitrary list from database'); } } foreach ($udbb0c as $d8ce4b => $t9e366){ $udbb0c[$d8ce4b]['current?'] = ($udbb0c[$d8ce4b]['href']==$_current_url); } if(Log::$ned2b5)__log('}'); return $udbb0c; } function we9f2(){ global$_config; $u632a2=time()-f35c3($_config['popular_period']); return h8696(array ( '_log' => 'most_read', 'cache' => CACHE_POPULAR, 'cache-filename' => CACHE_FILENAME_POPULAR, 'cache-filename-expires' => CACHE_FILENAME_POPULAR_EXPIRES, 'expires-after' => SECONDS_IN_A_DAY, 'query' => ( "SELECT n.`ID`, n.`Title`, n.`IsFavourite`, ". "a.`EntityID`, SUM(a.`ReadCount`) ReadCount ". "FROM `". $_config['db_table_prefix']."Actions` a, ". "`". $_config['db_table_prefix']."Notes` n  ". "WHERE a.`SubsetID`=". $_config['db_table_subset'] ." ". "AND n.`SubsetID`=". $_config['db_table_subset'] ." ". "AND a.`Stamp` > ". $u632a2 ." ". "AND n.`IsPublished` = 1 ". w6f32(we852()). "AND a.`EntityID` = n.`ID` ". "GROUP BY a.`EntityID` ". "ORDER BY `IsFavourite` DESC, ReadCount DESC ". "LIMIT 10" ), )); } function o7f52(){ global$_strings; $oe292c=[ 'title' => $_strings['nm--most-read'], ]; $oe292c['each']=we9f2(); if(count($oe292c['each']) < 10) unset ($oe292c['each']); return $oe292c; } function e2m_password_reset(){ global$_strings,$_superconfig,$settings; if (!is_file(USER_FOLDER. 'password-reset.psa')) { $b3c6e0=sha1(rand()); $t572d4=x83c8('e2m_password', array ('recovery-key' => $b3c6e0)); @k6e52(USER_FOLDER. 'password-reset.psa',$t572d4); } $r2cb9d['title']=$_strings['pt--password-reset']; $r2cb9d['heading']=$_strings['pt--password-reset']; $d5bef8=(bool) ($k77613=$settings['user']['email']); $r2cb9d['form']='form-password-reset-email'; $r2cb9d['form-password-reset-email'] = array ( 'form-action' => x83c8('e2s_password_reset_email'), 'show-controls?' => $d5bef8, 'submit-text' => $_strings['fb--send-link-by-email'], ); if (!@$_superconfig['user_has_no_access_to_files']) { $r2cb9d['form-password-reset-email']['reset-info']=$_strings['gs--password-reset-link-saved']; } elseif (!$d5bef8){ q8a40($_strings['er--cannot-reset-password']); } return $r2cb9d; } function e2s_password_reset_email(){ global$_strings,$settings; if($_SERVER['REQUEST_METHOD']!='POST') return e2_go_to(); if(array_key_exists('email',$_POST))$a0c83f=trim($_POST['email']); if (!$a0c83f){ q8a40($_strings['er--cannot-send-link-email-empty']); e2_go_to(x83c8('e2m_password_reset')); die; } $v22207=@file_get_contents(USER_FOLDER. 'password-reset.psa'); if(strlen($v22207)==0){ q8a40($_strings['er--error-occurred']); e2_go_to(x83c8('e2m_password_reset')); die; } if ($k77613=$settings['user']['email']) { if ($a0c83f==$k77613){ $ade7a3=n3e5c( 'password-reset', array ('reset-href' => $v22207) ); $lb904c=$_strings['em--password-reset-subject']; $q1a49b='From: '. daed2(); fa41b($k77613,$lb904c,$ade7a3,$q1a49b); } q8a40($_strings['gs--password-reset-link-sent-maybe'],E2E_MESSAGE); e2_go_to(x83c8('e2m_password_reset')); die; } die; } function e2m_password($parameters){ global$settings,$_strings; $n2d832=false; $b3c6e0=''; if(array_key_exists('recovery-key',$parameters)) { $b3c6e0=$parameters['recovery-key']; $t572d4=x83c8('e2m_password', array ('recovery-key' => $b3c6e0)); $v22207=@file_get_contents(USER_FOLDER. 'password-reset.psa'); if(strlen($v22207) > 0){ $n2d832=($t572d4==$v22207); } } if (we852() or $n2d832){ $r2cb9d['title']=$_strings['pt--password']; $r2cb9d['heading']=$_strings['pt--password-for-blog']; if ($n2d832){ $r2cb9d['title']=$_strings['pt--password-reset']; $r2cb9d['heading']=$_strings['pt--password-reset']; } $r2cb9d['form']='form-password'; $r2cb9d['form-password'] = array ( 'form-action' => x83c8('e2s_password_save'), '.recovery-key' => $b3c6e0, 'recovering?' => $n2d832, 'submit-text' => $_strings['fb--change'], ); return $r2cb9d; } else { e2_go_to(); } } function e2m_sessions(){ global$settings,$_strings; $t2d6d8=j7785(); $r2cb9d['title']=$_strings['pt--sessions']; $r2cb9d['heading']=$_strings['pt--sessions']; $c161bc=array(); $b3c6e0=$_COOKIE[v8c3b('key')]; foreach ($t2d6d8['sessions'] as $d8ce4b => $t9e366){ $c161bc[] = array ( 'current?' => sha1($b3c6e0)===$t9e366['key_hash'], 'opened' => array ((int)$t9e366['stamp'],j3211()), 'ip-address' => $t9e366['remote_ip'], 'source' => ($t9e366['remote_ip']=='127.0.0.1')? $_strings['gs--locally']:$t9e366['remote_ip'], 'title' => hcc31($t9e366['ua']), 'user-agent' => $t9e366['ua']? $t9e366['ua']:$_strings['gs--unknown'], ); } $c161bc=array_reverse($c161bc); $r2cb9d['sessions']['each']=$c161bc; if(count($c161bc) > 1){ $r2cb9d['form']='form-sessions'; $r2cb9d['form-sessions'] = array ( 'form-action' => x83c8('e2s_drop_other_sessions'), 'submit-text' => $_strings['fb--end-all-sessions-but-this'], ); } return $r2cb9d; } function e2m_sign_in(){ if (we852()) { e2_go_to(x83c8('e2m_frontpage', array ('page' => 1))); } else { return array (); } } function e2m_sign_out(){ global$_strings; $t2d6d8=j7785(); $k48bb9=-1; if(array_key_exists('sessions',$t2d6d8) and is_array($t2d6d8['sessions'])) { foreach ($t2d6d8['sessions'] as $d8ce4b => $t9e366){ $b3c6e0=$_COOKIE[v8c3b('key')]; if(sha1($b3c6e0)===$t9e366['key_hash']) { $k48bb9=$d8ce4b; break; } } } if ($k48bb9 > -1) unset ($t2d6d8['sessions'][$k48bb9]); if (!z1d21($t2d6d8)) { q8a40($_strings['er--cannot-write-auth-data'],E2E_PERMISSIONS_ERROR); } ic64a('key',''); e2_go_to(); die; } function e2s_password_save(){ global$settings,$_strings; $n2d832=false; $z0512f=trim($_POST['old-password']); if ($b3c6e0=trim($_POST['recovery-key'])) { $t572d4=x83c8('e2m_password', array ('recovery-key' => $b3c6e0)); $v22207=@file_get_contents(USER_FOLDER. 'password-reset.psa'); if(strlen($v22207) > 0){ $n2d832=($t572d4==$v22207); } } if (ka8cf($z0512f) or $n2d832){ $u88162=trim($_POST['new-password']); if ($u88162!=''){ if (@k6e52(USER_FOLDER. '/password-hash.psa',serialize(sha1($u88162)))) { @unlink(USER_FOLDER. 'password-reset.psa'); q8a40($_strings['gs--password-changed'],E2E_MESSAGE); e2_go_to(); } else { q8a40($_strings['er--could-not-change-password'],E2E_PERMISSIONS_ERROR); e2_go_to(x83c8('e2m_password', array ('recovery-key' => ''))); } } else { q8a40($_strings['er--no-password-entered'],E2E_USER_ERROR); e2_go_to(x83c8('e2m_password', array ('recovery-key' => ''))); } } else { q8a40($_strings['er--wrong-password'],E2E_USER_ERROR); e2_go_to(x83c8('e2m_password', array ('recovery-key' => ''))); } die; } function e2s_sign_in_necessary(){ e2_go_to(x83c8('e2m_sign_in')); die; } function p1668(){ $r957b5=$_SERVER['REMOTE_ADDR']; if(array_key_exists('HTTP_X_FORWARDED_FOR',$_SERVER)) { $r957b5=array_pop(explode(',',$_SERVER['HTTP_X_FORWARDED_FOR'])); } return $r957b5; } function e2s_sign_in(){ global$_strings; $t2d6d8=j7785(); if($_SERVER['REQUEST_METHOD']=='POST'){ $g5f4dc=@$_POST['password']; $p6bc8e=@$_POST['is_public_pc']; } else { $g5f4dc=@$_GET['password']; $p6bc8e=false; } if (ka8cf($g5f4dc)) { @unlink(USER_FOLDER. 'password-reset.psa'); $u21d6f=array ( 'stamp' => time(), 'remote_ip' => p1668(), 'key_hash' => qe8ed($p6bc8e), 'ua' => $_SERVER['HTTP_USER_AGENT'], ); $t2d6d8['sessions'][] = $u21d6f; } elseif(strlen(trim($g5f4dc)) > 0){ ja711(); q8a40($_strings['er--wrong-password'],E2E_USER_ERROR); } if (!z1d21($t2d6d8)) { q8a40($_strings['er--cannot-write-auth-data'],E2E_PERMISSIONS_ERROR); e2_go_to(); die; } j4930(); die; } function e2s_drop_other_sessions(){ global$_strings; $t2d6d8=j7785(); foreach ($t2d6d8['sessions'] as $d8ce4b => $t9e366){ $b3c6e0=$_COOKIE[v8c3b('key')]; if(sha1($b3c6e0)===$t9e366['key_hash']) { $u21d6f=$t9e366; break; } } $t2d6d8['sessions'] = array ($u21d6f); if (!z1d21($t2d6d8)) { q8a40($_strings['er--cannot-write-auth-data'],E2E_PERMISSIONS_ERROR); } j4930(); die; } function ka8cf($g5f4dc){ $a8e9a8=@unserialize(file_get_contents(USER_FOLDER. '/password-hash.psa')); return (sha1($g5f4dc)===$a8e9a8 and trim($g5f4dc)!=''); } function qe8ed($s2a2a4=false){ global$settings; $b3c6e0=q2a24(); $c3f363=sha1($b3c6e0); ic64a('key',$b3c6e0, !$s2a2a4); return $c3f363; } function we852(){ global $e1c0b7,$settings,$_auth_sessions; if (isset ($e1c0b7)) return $e1c0b7; $e1c0b7=false; if (isset ($_COOKIE[v8c3b('key')])) { $b3c6e0=$_COOKIE[v8c3b('key')]; $t2d6d8=j7785(); $e0f83b=array(); if(array_key_exists('sessions',$t2d6d8) and is_array($t2d6d8['sessions'])) { foreach ($t2d6d8['sessions'] as $u21d6f){ $e0f83b[] = $u21d6f['key_hash']; } $_auth_sessions['count']=count($t2d6d8['sessions']); } if(1){ $e1c0b7=(bool)in_array(sha1($b3c6e0),$e0f83b,true); } if (!$e1c0b7){ ic64a('key',''); } } return $e1c0b7; } function j7785(){ if(is_file(USER_FOLDER.'auth.psa')) { $t2d6d8=unserialize(@file_get_contents(USER_FOLDER.'auth.psa')); if ($t2d6d8) return $t2d6d8; } return array (); } function z1d21($t2d6d8){ return k6e52(USER_FOLDER.'auth.psa',serialize($t2d6d8)); } function pc3fb(){ if ($b3c6e0=$_COOKIE[v8c3b('key')]) { return v8c3b('key') .'='. $b3c6e0 .""; } } function zff2e(){ if ($b3c6e0=$_COOKIE[v8c3b('key')]) { return 'Cookie: '. v8c3b('key') .'='. $b3c6e0 ."\r\n"; } return "\r\n"; } function hcc31($y5269f){ global$_strings; if(strstr($y5269f,'iPhone')) return$_strings['gs--ua-iphone']; if(strstr($y5269f,'iPad')) return$_strings['gs--ua-ipad']; if(strstr($y5269f,'Opera'))$r2cb9d=$_strings['gs--ua-opera']; if(strstr($y5269f,'Firefox'))$r2cb9d=$_strings['gs--ua-firefox']; if(strstr($y5269f,'Chrome'))$r2cb9d=$_strings['gs--ua-chrome']; if(strstr($y5269f,'Safari') and !strstr($y5269f,'Chrome'))$r2cb9d=$_strings['gs--ua-safari']; if (!$r2cb9d)$r2cb9d=$_strings['gs--ua-unknown']; if(strstr($y5269f,'Macintosh')) { if ($r2cb9d)$r2cb9d.=' '. $_strings['gs--ua-for-mac']; } return $r2cb9d; } function e2j_check_password(){ $a8e9a8=@unserialize(file_get_contents(USER_FOLDER. '/password-hash.psa')); $g5f4dc=''; if(array_key_exists('password',$_POST))$g5f4dc=$_POST['password']; ja711(); $gd1fc8=[ 'success' => true, 'data' => [ 'password-correct' => trim($g5f4dc)!=='' and sha1($g5f4dc)===$a8e9a8 ], ]; $gd1fc8=json_encode($gd1fc8); die ($gd1fc8); } function q2a24(){ $eb04ec=''; $gb8d1b='0123456789abcdef'; for ($f865c0=0; $f865c0 < 40; $f865c0++)$eb04ec.=$gb8d1b[mt_rand(0,15)]; $eb04ec.=time(); $eb04ec=sha1($eb04ec); return $eb04ec; } function ja711(){ if(is_file(USER_FOLDER. 'password-wait.psa')) { $waf788=unserialize( file_get_contents(USER_FOLDER. '/password-wait.psa') ); if ($waf788['delay'] < 5){ $waf788['delay'] ++; } if(time()-$waf788['time'] > SECONDS_IN_A_MINUTE){ $waf788['delay']=0; } $waf788['time']=time(); } else { $waf788=array ( 'time' => time(), 'delay' => 5, ); } k6e52(USER_FOLDER.'password-wait.psa',serialize($waf788)); sleep($waf788['delay']); } function i7874(){ static $e34e51; if(empty($e34e51))$e34e51=md5('seret'); return $e34e51; } function n1305($fb45cf){ $b3c6e0=i7874(); $o16ec1=strlen($b3c6e0); $h2db95=strlen($fb45cf); $r2cb9d=''; for ($f865c0=0; $f865c0 < $h2db95+rand(16,64); ++ $f865c0){ if ($f865c0 > $h2db95){ $t462e1=rand(0,127); } elseif ($f865c0==$h2db95){ $t462e1=0; } else { $t462e1=ord($fb45cf[$f865c0]); } $b18e1b=chr(($t462e1+ord($b3c6e0[$f865c0%$o16ec1])) % 256); $r2cb9d.=$b18e1b; } $r2cb9d=base64_encode($r2cb9d); return $r2cb9d; } function iee85($fb45cf){ $b3c6e0=i7874(); $o16ec1=strlen($b3c6e0); $fb45cf=base64_decode($fb45cf); $h2db95=strlen($fb45cf); $r2cb9d=''; for ($f865c0=0; $f865c0 < $h2db95; ++ $f865c0){ $ld9468=(ord($fb45cf[$f865c0]) + 256-ord($b3c6e0[$f865c0%$o16ec1])) % 256; if ($ld9468===0) break; $r2cb9d.=chr($ld9468); } return $r2cb9d; } function c126f(){ global$settings; if (we852()) { return []; } else { return [ 'form-action' => x83c8('e2s_sign_in'), 'form-check-password-action' => x83c8('e2j_check_password'), 'login-name' => @$settings['author'], 'public-pc?' => false, 'reset-href' => x83c8('e2m_password_reset'), ]; } } $_candies_installer=array ( 'e2s_build', 'e2m_info', 'e2m_install', 'e2j_check_db_config', 'e2j_list_databases', 'e2s_instantiate', 'e2s_install', 'e2s_update_perform', ); $_candies_public=array ( 'e2m_info', 'e2m_frontpage', 'e2m_rss', 'e2m_json', 'e2m_note', 'e2m_note_json', 'e2m_note_read', 'e2m_draft_preview', 'e2m_tags', 'e2m_tag', 'e2m_tag_rss', 'e2m_tag_json', 'e2m_favourites', 'e2m_most_commented', 'e2m_found', 'e2m_comments', 'e2m_everything', 'e2m_sitemap_xml', 'e2m_year', 'e2m_month', 'e2m_day', 'e2m_unsubscribe', 'e2m_theme_preview', 'e2m_password_reset', 'e2s_password_reset_email', 'e2m_password', 'e2s_password_save', 'e2s_sign_in', 'e2m_sign_out', 'e2m_gip_sign_in', 'e2m_gip_sign_in_callback', 'e2m_gip_sign_out', 'e2s_comment_process', 'e2s_search', 'e2s_bsi_step', 'e2j_check_password', 'e2s_notify', ); $_candies_to_disallow_in_read_only=array ( 'e2m_write', 'e2m_note_edit', 'e2s_note_process', 'e2s_note_publish', 'e2s_note_delete', 'e2m_note_flag_favourite', 'e2m_note_flag', 'e2m_comment_edit', 'e2m_comment_delete', 'e2m_comment_reply', 'e2m_comment_reply_delete', 'e2m_comment_flag', 'e2m_comment_flag_ajax', 'e2m_unsubscribe', 'e2s_comment_process', 'e2m_settings', 'e2m_timezone', ); $_candies_public=array_merge($_candies_public,$_candies_installer); $_candies_indexable=array ( 'e2m_note', ); $_candies_indexable_conditionally=array ( 'e2m_frontpage', 'e2m_tag', 'e2m_favourites', 'e2m_most_commented', 'e2m_found', 'e2m_tags', 'e2m_everything', ); $_candies_ajax=array ( 'e2j_check_db_config', 'e2j_list_databases', 'e2j_check_password', 'e2j_userpic_upload', 'e2j_userpic_remove', 'e2j_file_upload', 'e2j_file_remove', 'e2j_note_livesave', 'e2m_note_flag_favourite', 'e2m_comment_flag_ajax', 'e2m_tag_flag_ajax', ); function t3020(){ global$settings,$_lang,$_config,$_strings,$ra57c1; if(Log::$ned2b5)__log('Blog information'); $m126ac['author']=htmlspecialchars(k2640(),ENT_NOQUOTES,HSC_ENC); if(array_key_exists('description',$settings)) { $o2bfe4=bb7f1($settings['description'],'full'); $f67daf=$o2bfe4['text-final']; $m126ac['description']=$f67daf; $m126ac['description-format-info']=$o2bfe4['meta']; a57ad(@$o2bfe4['meta']['links-required']); } $m126ac['title']=htmlspecialchars(n6f51(),ENT_NOQUOTES,HSC_ENC); $m126ac['userpic-set?']=false; $m126ac['userpic-changeable?']=we852(); if ($m126ac['userpic-href']=f2461()) { $m126ac['userpic-set?']=true; $m126ac['userpic-large-href']=f2461('large'); $m126ac['userpic-square-href']=f2461('square'); $m126ac['userpic-changeable-href']=$m126ac['userpic-href']; } else { unset ($m126ac['userpic-href']); } if (we852()) { $m126ac['userpic-upload-action']=x83c8('e2j_userpic_upload'); $m126ac['userpic-remove-action']=x83c8('e2j_userpic_remove'); } $m126ac['href']=x83c8('e2m_frontpage', array ('page' => 1)); $m126ac['rss-href']=x83c8('e2m_rss'); $m126ac['jsonfeed-href']=x83c8('e2m_json'); $m126ac['language']=$_lang; $m126ac['show-subscribe-button?']=false; $l97bc5=array (time(),g5c05()); $a5f36b=qa846('Y',$l97bc5[0]); $m126ac['now']=$l97bc5; $faa103=$a5f36b; $a33b09=lcc02('start'); if(array_key_exists('stamp',$a33b09)) { $faa103=qa846('Y',$a33b09['stamp']); $m126ac['start-time'] = array ((int)$a33b09['stamp'],$a33b09['timezone']); } $bd0a87=false; $k40d73=u3456(true,true); if ($k40d73!==null){ if (we852()) { $fa4f0c=u3456(true,false); if ($fa4f0c!==null){ $bd0a87=($k40d73+$fa4f0c==0); } } else { $bd0a87=($k40d73==0); } } $m126ac['notes-count'] = (int)$k40d73; $m126ac['virgin?']=$bd0a87; $j9fbfe=$_config['years_range_separator']? $_config['years_range_separator']:$_strings['gs--range-separator']; $m126ac['years-range']=$faa103 . (($faa103==$a5f36b)? '':($j9fbfe.$a5f36b)); if ($ra57c1){ $m126ac['parent-site-href']=substr($ra57c1, (int)strpos('/',$ra57c1)); } return $m126ac; } function n6f51(){ global$settings,$_strings; if ( array_key_exists('site_title',$settings) and trim($settings['site_title']) != '' ){ return trim($settings['site_title']); } else { return$_strings['e2--default-blog-title']; } } function k2640(){ global$settings,$_strings; if ( array_key_exists('author',$settings) and trim($settings['author']) != '' ){ return trim($settings['author']); } else { return$_strings['e2--default-blog-author']; } } function f2461($size=''){ global$full_blog_url; if (!is_file($j435ed=USER_FOLDER .'[email protected]')) { if (!is_file($j435ed=USER_FOLDER .'[email protected]')) { return false; } } if($size=='large' and is_file(USER_FOLDER .'[email protected]')) { $j435ed=USER_FOLDER .'[email protected]'; } if($size=='square' and is_file(USER_FOLDER .'[email protected]')) { $j435ed=USER_FOLDER .'[email protected]'; } $jbc7b3=stat($j435ed); if ($jbc7b3['mtime']) { $j435ed.='?'. $jbc7b3['mtime']; } $mc315c=$full_blog_url .'/'. $j435ed; return $mc315c; } function l6442(){ global$_config,$_stopwatch,$k11755; $yc8542=round(v7f78()-$_stopwatch,3); return [ 'show?' => ($_config['display_stat'] > (int) !we852()), 'generation-time' => str_replace('.',',',$yc8542), 'peak-memory-mb' => str_replace('.',',',round((memory_get_peak_usage()/1024/1024)*100)/100), 'db-query-count' => (int) @$k11755, ]; } function e2m_info(){ global$settings,$_config,$x57de2,$ra57c1,$_template; $cf1f71=array ( 'E2_VERSION' => E2_VERSION, 'E2_RELEASE' => E2_RELEASE, 'E2_UA_STRING' => E2_UA_STRING, '---', 'PHP_VERSION' => PHP_VERSION, '---', 'installed' => (n2ac5()!==null), 'server_name' => $x57de2, 'folder_on_server' => $ra57c1, '---', 'default formatter' => $_config['default_formatter'], '---', 'theme' => $settings['template'], '---', 'Olba name' => $_template['name'], 'Olba max_image_width' => $_template['max_image_width'], 'Olba stack' => $_template['stack'], '---', 'Neasden' => substr(md5(file_get_contents('system/neasden/neasden.php')), 0,4), '---', ); echo '<pre>'; foreach ($cf1f71 as $d8ce4b => $t9e366){ if ($t9e366=='---'){ echo "\n"; continue; } echo str_pad($d8ce4b,24); echo '\''; print_r($t9e366); echo '\''; echo "\n"; } echo '</pre>'; die; } function e2s_notify(){ global$_config; if($_config['holborn']) { $w4de32=@$_GET['src']; if ($w4de32==''){ if(Log::$ned2b5)__log('Holborn: No src URL'); die; } $z466de=file_get_contents($w4de32); $z466de=n09a6($z466de); $ae13b0=json_decode($z466de,true); if (!$ae13b0){ if(Log::$ned2b5)__log('Holborn: No meaningful info from '. $w4de32 .' ('. json_last_error() .')'); if ($i13bc3=vdd69($w4de32)) { if(Log::$ned2b5)__log('Holborn: Delete note with ID '. $i13bc3['ID']); le268($i13bc3['ID']); } die; } m927d($ae13b0,$w4de32); } die; } function e2m_sources($parameters){ global$_config; $b8bef1=$_GET['ord']; if (!$b8bef1)$b8bef1='ID'; $b8bef1="`". a7928($b8bef1) ."`"; u0738( "SELECT *, REPLACE(REPLACE(REPLACE(`URL`, 'http://', ''), 'https://', ''), 'www.', '') AS _URLX ". "FROM `". $_config['db_table_prefix']."Sources` " . "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "ORDER BY ". $b8bef1 ); $result=d0d6b(); foreach($result as $r447b7){ $nc615c=$r447b7['ID']; if ($r447b7['ID']!=$r447b7['TrueID'])$nc615c.='<br />'. $r447b7['TrueID']; $h36cd3=array ( 'id' => $nc615c, 'userpic-href' => $r447b7['PictureURL'], 'href' => $r447b7['URL'], 'href-display' => str_replace('/','/<wbr>',$r447b7['URL']), 'href-filtered' => str_replace('/','/<wbr>',$r447b7['_URLX']), 'title' => $r447b7['Title'], 'author' => $r447b7['AuthorName'], 'true?' => $r447b7['ID']==$r447b7['TrueID'], 'whitelisted?' => $r447b7['IsWhiteListed'], 'trusted?' => $r447b7['IsTrusted'], ); if (!$r447b7['IsTrusted']) { $h36cd3['trust-url']=x83c8( 'e2m_source_trust', array ('source' => $r447b7['ID']) ); } if ($r447b7['IsTrusted']) { $h36cd3['premoderate-url']=x83c8( 'e2m_source_premoderate', array ('source' => $r447b7['ID']) ); } $h36cd3['ban-url']=x83c8( 'e2m_source_ban', array ('source' => $r447b7['ID']) ); $h36cd3['forget-url']=x83c8( 'e2m_source_forget', array ('source' => $r447b7['ID']) ); $ff2ab5[] = $h36cd3; } $r2cb9d=array ( 'title' => 'Sources', 'heading' => 'Sources', ); if(count($ff2ab5)) { $r2cb9d['sources']=$ff2ab5; } else { $r2cb9d['nothing']='No sources'; } return $r2cb9d; } function e2m_source_trust($parameters){ global$_config; $d0afd9=$parameters['source']; u0738( "UPDATE  ". $_config['db_table_prefix']."Sources ". "SET `IsWhitelisted`=1, `IsTrusted`=1 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $d0afd9, 'trust source' ); u0738( "UPDATE  ". $_config['db_table_prefix']."Notes ". "SET `IsPublished`=1 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `SourceID`=". $d0afd9, 'publish all notes from the just trusted source' ); c198f(); i7996(); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); e2_go_to(''); die; } function e2m_source_premoderate($parameters){ global$_config; $d0afd9=$parameters['source']; u0738( "UPDATE  ". $_config['db_table_prefix']."Sources ". "SET `IsTrusted`=0 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $d0afd9, 'distrust source, set to premoderation' ); i7996(); e2_go_to(''); die; } function e2m_source_ban($parameters){ global$_config; $d0afd9=$parameters['source']; u0738( "UPDATE  ". $_config['db_table_prefix']."Sources ". "SET `IsWhiteListed`=0, `IsTrusted`=0 ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $d0afd9, 'ban source' ); u0738( "DELETE FROM  ". $_config['db_table_prefix']."Notes ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `SourceID`=". $d0afd9, 'delete all notes from the just banned source' ); i7996(); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); e2_go_to(''); die; } function e2m_source_forget($parameters){ global$_config; $d0afd9=$parameters['source']; u0738( "DELETE FROM  ". $_config['db_table_prefix']."Sources ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`=". $d0afd9, 'forget source' ); u0738( "DELETE FROM  ". $_config['db_table_prefix']."Notes ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `SourceID`=". $d0afd9, 'delete all notes from the just forgotten source' ); i7996(); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); e2_go_to(''); die; } function m927d($na7251,$w4de32){ if(Log::$ned2b5)__log('Holborn: Note info == '. print_r($na7251,true)); $va4a84=k10cd(array ( 'author' => $na7251['author']['name'], 'title' => $na7251['title'], 'href' => $na7251['author']['url'], 'userpic-href' => $na7251['author']['avatar'], )); if (!$va4a84['IsWhiteListed']) return; if(preg_match('/\+(\d\d)\:(\d\d)/',$na7251['items'][0]['date_published'],$j9c28d)) { $v7a86c=$j9c28d[1]*SECONDS_IN_AN_HOUR+$j9c28d[2]*SECONDS_IN_A_MINUTE; } $a929cf=@$na7251['items'][0]['_e2_data'] or $a929cf=array(); $a929cf=json_encode($a929cf); $w39a37=array ( 'Title' => $na7251['items'][0]['title'], 'Text' => $na7251['items'][0]['content_html'], 'FormatterID' => 'raw', 'OriginalAlias' => '', 'Uploads' => '', 'Stamp' => strtotime($na7251['items'][0]['date_published']), 'Offset' => (int)$v7a86c, 'IsDST' => 0, 'LastModified' => strtotime($na7251['items'][0]['date_modified']), 'IsCommentable' => 0, 'IsPublished' => $va4a84['IsTrusted'], 'IsExternal' => 1, 'SourceID' => $va4a84['ID'], 'SourceNoteID' => $na7251['items'][0]['id'], 'SourceNoteURL' => $na7251['items'][0]['url'], 'SourceNoteJSONURL' => $w4de32, 'SourceNoteData' => $a929cf, ); $y21158=$na7251['items'][0]['id']; if ( $i13bc3=df25e($va4a84['ID'],$y21158) ) { $w39a37['ID']=$i13bc3['ID']; qaa79('Notes',$w39a37); } else { $w39a37=v9943('Notes',$w39a37); } if (vd2e1($w39a37)) { $w39a37['IsIndexed']='1'; qaa79('Notes',$w39a37); } e2_drop_caches_for_note_($w39a37['ID']); @unlink(CACHE_FILENAME_DRAFTS); @unlink(CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS); } function vdd69($w4de32){ global$_config; u0738( "SELECT `ID` FROM ". $_config['db_table_prefix']."Notes ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `SourceNoteJSONURL`='". $w4de32 ."' ". "LIMIT 1", 'get note ID by source JSON URL' ); $result=d0d6b(); return$result[0]; } function df25e($d0afd9,$ibb971){ global$_config; u0738( "SELECT `ID` FROM ". $_config['db_table_prefix']."Notes ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `SourceID`= '". $d0afd9 ."' ". "AND `SourceNoteID`= '". $ibb971 ."' ". "LIMIT 1", 'get note ID by source ID and source note ID' ); $result=d0d6b(); return$result[0]; } function n09a6($z466de){ for ($f865c0=0; $f865c0 <= 31; ++$f865c0){ $z466de=str_replace(chr($f865c0),'',$z466de); } $z466de=str_replace(chr(127),'',$z466de); if(0===strpos(bin2hex($z466de),'efbbbf')) { $z466de=substr($z466de,3); } return $z466de; } function k10cd($x03396){ global$_config; $m305c2=false; u0738( "SELECT * FROM ". $_config['db_table_prefix']."Sources ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `URL`= '". $x03396['href'] ."' ". "LIMIT 1", 'get source record by the URL from blog info' ); $result=d0d6b(); if(count($result)) { $m305c2=$result[0]; if ($m305c2['ID']!=$m305c2['TrueID']) { u0738( "SELECT * FROM ". $_config['db_table_prefix']."Sources ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID`= '". $m305c2['TrueID'] ."' ". "LIMIT 1", 'get true source record by using the TrueID of just found record' ); $result=d0d6b(); if(count($result)) { $m305c2=$result[0]; } } } $va4a84=array ( 'Title' => $x03396['title'], 'AuthorName' => $x03396['author'], 'PictureURL' => $x03396['userpic-href'], ); if ($m305c2!==false){ if ( $m305c2['Title']!==$x03396['title'] or $m305c2['AuthorName']!==$x03396['author'] or $m305c2['PictureURL']!==$x03396['userpic-href'] ) { $va4a84['ID']=$m305c2['ID']; qaa79('Sources',$va4a84); } return $m305c2; } else { $va4a84['URL']=$x03396['href']; $va4a84['IsWhiteListed']=1; $va4a84['IsTrusted']=0; $va4a84=v9943('Sources',$va4a84); $va4a84['TrueID']=$va4a84['ID']; qaa79('Sources',$va4a84); return $va4a84; } } function q1a48($w39a37,$u34d5a=false){ global$_config; $vc6827=array(); if (@$w39a37['IsExternal']) { if(array_key_exists('SourceID',$w39a37)) { u0738( "SELECT * FROM `". $_config['db_table_prefix']."Sources` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `ID` = '". $w39a37['SourceID'] ."'", 'get source by id' ); $cfa816=d0d6b(); $vc6827['source']=$cfa816[0]['Title']; $vc6827['source-id']=$w39a37['SourceID']; $vc6827['source-true-id']=$cfa816[0]['TrueID']; $vc6827['source-whitelisted?']=$cfa816[0]['IsWhiteListed']; $vc6827['source-trusted?']=$cfa816[0]['IsTrusted']; if (!$cfa816[0]['IsTrusted']) { $vc6827['source-trust-url']=x83c8( 'e2m_source_trust', array ('source' => $w39a37['SourceID']) ); } if ($cfa816[0]['IsTrusted']) { $vc6827['source-premoderate-url']=x83c8( 'e2m_source_premoderate', array ('source' => $w39a37['SourceID']) ); } $vc6827['source-ban-url']=x83c8( 'e2m_source_ban', array ('source' => $w39a37['SourceID']) ); $vc6827['source-forget-url']=x83c8( 'e2m_source_forget', array ('source' => $w39a37['SourceID']) ); $vc6827['author']=$cfa816[0]['AuthorName']; $vc6827['author-href']=$cfa816[0]['URL']; $vc6827['userpic-href']=$cfa816[0]['PictureURL']; } if ($u34d5a){ if(array_key_exists('SourceNoteURL',$w39a37) and @$w39a37['SourceNoteURL']!=''){ $vc6827['href']=$w39a37['SourceNoteURL']; $vc6827['href-original']=$w39a37['SourceNoteURL']; } } } return $vc6827; } function e2m_frontpage($parameters=array ()) { global$settings,$_config,$_strings; $e71860=$parameters['page']; $iae0fe=1; $hd7e5d=$settings['appearance']['notes_per_page']; $u06d2e=u3456(true,true); if ($u06d2e!==null){ if (we852()) { $c90953=u3456(true,false); if ($c90953!==null)$u06d2e+=$c90953; } $iae0fe=ceil($u06d2e/$hd7e5d); } $xd29bb=CACHE_FILENAME_FRONTPAGE; if (we852())$xd29bb=CACHE_FILENAME_FRONTPAGE_AUTHOR; if ($e71860 < 1) return e2_error404_mode(); if(CACHE_FRONTPAGE and $e71860==1 and is_file($xd29bb)) { $z4358b=@unserialize(file_get_contents($xd29bb)); } if(CACHE_FRONTPAGE and $e71860==1 and is_array($z4358b)) { } else { try { $result=q7573($e71860); $z4358b=array(); if(count($result) > 0){ foreach($result as $d8ce4b => $saad65){ $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_title']=$saad65['Title']; $saad65['_']['_ord']=$d8ce4b; $saad65['_']['_ord_max']=count($result)-1; $ke244c=o6791($saad65); $z4358b[] = $ke244c; } } else { if ($e71860!=1) return e2_error404_mode(); } if(CACHE_FRONTPAGE and $e71860==1)k6e52($xd29bb,serialize($z4358b)); } catch (AeMySQLException $e){ b12f6($e,'Could not get latest notes for page '. $e71860); return array ( 'unavailable?' => true, 'title' => htmlspecialchars(n6f51(),ENT_NOQUOTES,HSC_ENC), ); } } $db3b32['timeline?']=true; $db3b32['count']=$iae0fe; $db3b32['this'] = (int)$e71860; if ($iae0fe > 1){ if ($e71860 < $iae0fe)$db3b32['earlier-href']=x83c8('e2m_frontpage', array ('page' => $e71860+1)); if ($e71860 > 1)$db3b32['later-href']=x83c8('e2m_frontpage', array ('page' => $e71860-1)); $db3b32['earlier-title']=$_strings['gs--earlier']; $db3b32['later-title']=$_strings['gs--later']; } $ld5d3d=n6f51(); return array ( 'frontpage?' => (bool) ($e71860==1), 'title' => $ld5d3d, 'notes' => $z4358b, 'pages' => $db3b32, ); } function q7573($e71860=1){ global$settings,$_config; $b19ee4=($e71860-1)*$settings['appearance']['notes_per_page']; $maa9f7=$b19ee4 .', '. $settings['appearance']['notes_per_page']; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". w6f32(we852()). "ORDER BY `Stamp` DESC ". "LIMIT ". $maa9f7, 'get latest notes for page '. $e71860 ); return d0d6b(); } function e2m_json($parameters=array ()) { list ($pb9076,$u20612)=lab26(); $z466de=json_encode($pb9076,E2_JSON_STYLE); q8ec5($z466de,$u20612,'json'); } function e2m_rss($parameters=array ()) { list ($pb9076,$u20612)=lab26(); $k8bb85=e2feeds__rss_using_jsonfeed_array_($pb9076); q8ec5($k8bb85,$u20612,'rss'); } function e2m_tag_json($parameters=array ()) { if(array_key_exists('*tag',$parameters)) { $rb19ad=$parameters['*tag']; } else { return e2_error404_mode(); } list ($pb9076,$u20612)=ce229($rb19ad); $z466de=json_encode($pb9076,E2_JSON_STYLE); q8ec5($z466de,$u20612,'json'); } function e2m_tag_rss($parameters=array ()) { global$settings,$_config,$_strings; if(array_key_exists('*tag',$parameters)) { $rb19ad=$parameters['*tag']; } else { return e2_error404_mode(); } list ($pb9076,$u20612)=ce229($rb19ad); $k8bb85=e2feeds__rss_using_jsonfeed_array_($pb9076); q8ec5($k8bb85,$u20612,'rss'); } function e2m_note_json($parameters=array ()) { global$settings,$_current_url; $w39a37=$parameters['*note']; if ($w39a37==false){ return e2_error404_mode(); } if (!yb44b($w39a37,we852())) { return e2_error404_mode(); } $w39a37['_']['_id']=$w39a37['ID']; $u20612=$w39a37['Stamp']; $d7da21=e2_jsonfeed_item_array_from_noterec_($w39a37); $k0bf08=array ($d7da21); $pb9076=e2_jsonfeed_array_stub_from_jsonfeed_item_arrays_($k0bf08); $pb9076['title']=n6f51(); $pb9076['home_page_url']=x83c8('e2m_frontpage', array ('page' => 1)); $pb9076['feed_url']=$_current_url; q8ec5(json_encode($pb9076,E2_JSON_STYLE),$u20612,'json'); } function e2_jsonfeed_array_stub_from_jsonfeed_item_arrays_($k0bf08){ global$_lang,$_config,$settings; $r2cb9d=[ 'version' => 'https://jsonfeed.org/version/1', 'title' => null, '_rss_description' => null, '_rss_language' => $_lang, '_itunes_email' => '', '_itunes_categories_xml' => '', '_itunes_image' => '', '_itunes_explicit' => '', 'home_page_url' => null, 'feed_url' => null, 'icon' => f2461(), 'author' => array ( 'name' => k2640(), 'url' => x83c8('e2m_frontpage', array ('page' => 1)), 'avatar' => f2461(), ), 'items' => $k0bf08, '_e2_version' => E2_VERSION, '_e2_ua_string' => E2_UA_STRING, ]; return $r2cb9d; } function e2_jsonfeed_item_array_from_noterec_($w39a37){ global$settings; $w39a37['_']['_id']=$w39a37['ID']; $t572d4=x83c8('e2m_note', array ('*note' => $w39a37)); $d803d0=( qa846('Y-m-d\TH:i:s',$w39a37['Stamp']) . nd536($w39a37['Stamp'],':') ); $aade16=( qa846('Y-m-d\TH:i:s',$w39a37['LastModified']) . nd536($w39a37['LastModified'],':') ); $s316ec=( qa846('D, d M Y H:i:s ',$w39a37['Stamp']) . nd536($w39a37['Stamp']) ); $o2bfe4=j154e($w39a37['FormatterID'], @$w39a37['Text'],'full-rss'); $sad965=tdbcc( 'note',$w39a37['_']['_id'], $o2bfe4['meta']['resources-detected'] ); $we70c4=array ( 'id' => (string)$w39a37['ID'], 'url' => $t572d4, 'title' => u6f10(htmlspecialchars($w39a37['Title'],ENT_NOQUOTES)), 'content_html' => $o2bfe4['text-final'], 'date_published' => $d803d0, 'date_modified' => $aade16, ); if ($w39a37['IsExternal']) { $b60d40=q1a48($w39a37,true); $we70c4['url']=$b60d40['href']; $we70c4['author'] = array ( 'name' => $b60d40['author'], 'url' => $b60d40['author-href'], 'avatar' => $b60d40['userpic-href'], ); } if(count($sad965) > 0){ $we70c4['image']=$sad965[0]; } $we70c4['_date_published_rfc2822']=$s316ec; if ($w39a37['Stamp'] < $settings['v3223_rss_permalinks_before_stamp']) { $we70c4['_rss_guid_is_permalink']='true'; $we70c4['_rss_guid']=$we70c4['url']; } else { $we70c4['_rss_guid_is_permalink']='false'; $we70c4['_rss_guid'] = (string)$w39a37['ID']; } $we70c4['_e2_data'] = array ( 'is_favourite' => (bool)$w39a37['IsFavourite'], 'links_required' => $o2bfe4['meta']['links-required'], 'og_images' => $sad965, ); return $we70c4; } function q3010($j7a402,$ld5d3d,$xe8fab){ global$_newsfeeds; if (!isset ($_newsfeeds))$_newsfeeds=[]; $kfc0f6=''; if ($j7a402=='rss')$kfc0f6='application/rss+xml'; if ($j7a402=='json')$kfc0f6='application/json'; $_newsfeeds[] = [ 'type' => $kfc0f6, 'title' => htmlspecialchars($ld5d3d,ENT_NOQUOTES,HSC_ENC), 'href' => $xe8fab ]; } function oed63(){ global$_config; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". w6f32(). "ORDER BY `Stamp` DESC ". "LIMIT ". $_config['rss_items'], 'get recent public noterecs for RSS or JSONFeed' ); return d0d6b(); } function lab26(){ global$settings,$_current_url; $u20612=0; $k0bf08=array(); $pb9076=array(); $xd29bb=CACHE_FILENAME_FRONTPAGE_FEED; if(CACHE_FRONTPAGE_FEED and is_file($xd29bb)) { if(Log::$ned2b5)__log('Feed array (RSS, JSON): cached'); $pb9076=@unserialize(file_get_contents($xd29bb)); $u20612=filemtime($xd29bb); } else { if(Log::$ned2b5)__log('Feed array (RSS, JSON): not cached, will need to build'); $pc2d18=oed63(); foreach ($pc2d18 as $w39a37){ $k0bf08[] = e2_jsonfeed_item_array_from_noterec_($w39a37); $u20612=max($u20612,$w39a37['Stamp']); } $f67daf=''; if(array_key_exists('description',$settings)) { $f67daf=$settings['description']; } if ((string)$f67daf!==''){ $o2bfe4=bb7f1($f67daf,'full'); $tfc882=$o2bfe4['text-final']; $tfc882=m5421($tfc882); } else { $tfc882=n6f51(); } $pb9076=e2_jsonfeed_array_stub_from_jsonfeed_item_arrays_($k0bf08); $pb9076['title']=n6f51(); $pb9076['_rss_description']=$tfc882; $pb9076['home_page_url']=x83c8('e2m_frontpage', array ('page' => 1)); $pb9076['feed_url']=$_current_url; if(CACHE_FRONTPAGE_FEED)k6e52($xd29bb,serialize($pb9076)); } return array ($pb9076,$u20612); } function ce229($rb19ad){ global$settings,$_config,$_strings,$_current_url; $u20612=0; $k0bf08=array(); u0738( "SELECT n.* ". "FROM `". $_config['db_table_prefix']."Notes` n ". "INNER JOIN `". $_config['db_table_prefix']."NotesKeywords` nk ". "ON nk.`NoteID` = n.`ID` ". "WHERE n.`SubsetID`=". $_config['db_table_subset'] ." ". "AND nk.`SubsetID`=". $_config['db_table_subset'] ." ". "AND (nk.`KeywordID` = ". $rb19ad['ID'] .") ". "AND n.`IsPublished` = 1 ". w6f32(we852()). "ORDER BY n.`Stamp` DESC ". "LIMIT ". $_config['rss_items'], 'get tag noterecs for RSS or JSONFeed' ); $pc2d18=d0d6b(); foreach ($pc2d18 as $w39a37){ $k0bf08[] = e2_jsonfeed_item_array_from_noterec_($w39a37); $u20612=max($u20612,$w39a37['Stamp']); } $f67daf=''; if ((string)$rb19ad['Description']!==''){ $f67daf=$rb19ad['Description']; } elseif(array_key_exists('description',$settings)) { $f67daf=$settings['description']; } if ((string)$f67daf!==''){ $o2bfe4=bb7f1($f67daf,'full'); $tfc882=$o2bfe4['text-final']; $tfc882=m5421($tfc882); } else { $tfc882=n6f51(); } $wb73b1=htmlspecialchars($rb19ad['PageTitle'],ENT_COMPAT,HSC_ENC); if ((string)$wb73b1!==''){ $ld5d3d=$wb73b1; } else { $ld5d3d=( n6f51() .': '. $_strings['gs--posts-tagged'] .' '. htmlspecialchars($rb19ad['Keyword'],ENT_COMPAT,HSC_ENC) ); } $pb9076=e2_jsonfeed_array_stub_from_jsonfeed_item_arrays_($k0bf08); $pb9076['title']=$ld5d3d; $pb9076['_rss_description']=$tfc882; $pb9076['home_page_url']=x83c8('e2m_tag', array ('*tag' => $rb19ad)); $pb9076['feed_url']=$_current_url; return array ($pb9076,$u20612); } function e2feeds__rss_using_jsonfeed_array_($content){ $b92eac=USER_FOLDER.'rss/rss.tmpl.php'; if (!is_file($b92eac)) { $b92eac=DEFAULTS_FOLDER.'rss/rss.tmpl.php'; } if(is_file($b92eac)) { ob_start(); include $b92eac; $k8bb85=ob_get_contents(); ob_end_clean(); } return $k8bb85; } function b99a9($k8bb85){ $k8bb85=str_replace("\x0",'',$k8bb85); for ($f865c0=0; $f865c0 < strlen($k8bb85); ++$f865c0){ if(ord($k8bb85[$f865c0]) < 32 and !in_array(ord($k8bb85[$f865c0]), array (10,13))) { $k8bb85[$f865c0]=''; } } return $k8bb85; } function q8ec5($n321c3,$u20612,$j7a402){ global$_config; $f69a10=gmdate('r',$u20612); $t1872a=md5($u20612); if ($j7a402=='rss'){ if (@$_config['dev_xml_as_text']) { header('Content-Type: text/plain'); } else { header('Content-Type: application/xml; charset=utf-8'); } } elseif ($j7a402=='json'){ header('Content-Type: application/json'); } else { header('Content-Type: text/plain'); } header('Last-modified: '. $f69a10); header('Etag: '. $t1872a); header('Cache-Control: public'); header('Expires: '. date('r',$u20612+SECONDS_IN_A_DAY)); $d0c3cd=isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false; $rc3522=isset($_SERVER['HTTP_IF_NONE_MATCH'])? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : false; if ( !$d0c3cd && !$rc3522 or $rc3522 && $rc3522!=$t1872a or $d0c3cd && $d0c3cd!=$f69a10 ){ if ($j7a402=='rss'){ $k8bb85=b99a9($k8bb85); } ini_set('zlib.output_compression',0); echo $n321c3; ini_set('zlib.output_compression',1); } else { header('HTTP/1.1 304 Not Modified'); } die; } function e2m_year($parameters=array ()) { global$_strings,$_config; $g84cdc=$parameters['year']; $u09d6c=e2l_get_string('pt--nth-year', array ('year' => $g84cdc)); if (!i1665($g84cdc)) { return e2_error404_mode(); } $ye6e7d=gmmktime(0,0,0,1,1,$g84cdc-1); $a029bd=gmmktime(0,0,0,1,1,$g84cdc+1); list ($a8aebd,$n5a7f3)=e2__fruitful_neighbours_with_ymd_($g84cdc); $xa6d40='e2m_year'; if ($a8aebd){ $db3b32['prev-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($a8aebd) ); $db3b32['prev-jump?'] = (bool) (gmdate('Y',$ye6e7d)!=gmdate('Y',$a8aebd)); $db3b32['prev-title']=gmdate('Y',$a8aebd); } if ($n5a7f3){ $db3b32['next-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($n5a7f3) ); $db3b32['next-jump?'] = (bool) (gmdate('Y',$a029bd)!=gmdate('Y',$n5a7f3)); $db3b32['next-title']=gmdate('Y',$n5a7f3); } $db3b32['timeline?']=false; $db3b32['this']=$g84cdc; $db3b32['this-title']=$g84cdc; $zb2442=lcc02('start'); $s8dbc7=lcc02('end'); if ( $g84cdc==h5a2f('Y',$zb2442['stamp'],$zb2442['timezone']) ) { $bfa098=h5a2f('m',$zb2442['stamp'],$zb2442['timezone']); } else { $bfa098=1; } if ( $g84cdc==qa846('Y',time()) ) { $cfd384=qa846('m',time()); } else { $cfd384=12; } $o6eac3=a9737($g84cdc); for ($n7436f=1; $n7436f <= 12; ++ $n7436f){ $a7f769=gmmktime(0,0,0,$n7436f,1,$g84cdc); $qd039b[$n7436f] = array ( 'number' => $n7436f, 'start-time' => array ($a7f769,j3211()), 'href' => gmdate('Y/m/',$a7f769), 'real?' => $n7436f >= $bfa098 and $n7436f <= $cfd384, 'fruitful?' => @in_array(gmdate('n',$a7f769),$o6eac3), ); } list ($b7b314,$wa1f20)=z5273($g84cdc); $r2cb9d=[ 'title' => $u09d6c, 'heading' => $u09d6c, 'pages' => $db3b32, 'year' => (int)$g84cdc, 'year-months' => $qd039b, ]; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished` = 1 ". w6f32(we852()). "AND `Stamp` BETWEEN ". $b7b314 ." ". "AND ". $wa1f20 ." ". "ORDER BY `Stamp`", 'get all notes for the year' ); $result=d0d6b(); $z4358b=o28df($result,$g84cdc); if(count($z4358b)) { $r2cb9d['notes-list']=$z4358b; } else { $r2cb9d['nothing']=$_strings['gs--no-such-notes']; } return $r2cb9d; } function e2m_month($parameters=array ()) { global$_strings,$_config; $g84cdc= $parameters['year']; $n7436f=$parameters['month']; $u09d6c=e2l_get_string( 'pt--nth-month-of-nth-year', array ('year' => $g84cdc,'month' => $n7436f) ); if (!i1665($g84cdc,$n7436f)) { return e2_error404_mode(); } $ye6e7d=gmmktime(0,0,0,$n7436f-1,1,$g84cdc); $a029bd=gmmktime(0,0,0,$n7436f+1,1,$g84cdc); list ($a8aebd,$n5a7f3)=e2__fruitful_neighbours_with_ymd_($g84cdc,$n7436f); $xa6d40='e2m_month'; if ($a8aebd){ $db3b32['prev-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($a8aebd) ); $db3b32['prev-jump?'] = (bool) (gmdate('Y/m',$ye6e7d)!=gmdate('Y/m',$a8aebd)); $db3b32['prev-title']=e2l_get_string( 'gs--nth-month-of-nth-year', array ( 'year' => gmdate('Y',$a8aebd),'month' => gmdate('n',$a8aebd) ) ); } if ($n5a7f3){ $db3b32['next-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($n5a7f3) ); $db3b32['next-jump?'] = (bool) (gmdate('Y/m',$a029bd)!=gmdate('Y/m',$n5a7f3)); $db3b32['next-title']=e2l_get_string( 'gs--nth-month-of-nth-year', array ( 'year' => gmdate('Y',$n5a7f3),'month' => gmdate('n',$n5a7f3) ) ); } $db3b32['timeline?']=false; $db3b32['this-title']=$u09d6c; list ($b7b314,$wa1f20)=z5273($g84cdc,$n7436f); $r2cb9d=[ 'title' => $u09d6c, 'heading' => $u09d6c, 'pages' => $db3b32, 'year' => (int)$g84cdc, 'month' => (int)$n7436f, 'month-days' => e2_pack_month_days_with_ymd_($g84cdc,$n7436f,false), ]; u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished` = 1 ". w6f32(we852()). "AND `Stamp` BETWEEN ". $b7b314 ." ". "AND ". $wa1f20 ." ". "ORDER BY `Stamp`", 'get all notes for the month' ); $result=d0d6b(); $z4358b=o28df($result,$g84cdc,$n7436f); if(count($z4358b)) { $r2cb9d['notes-list']=$z4358b; } else { $r2cb9d['nothing']=$_strings['gs--no-such-notes']; } return $r2cb9d; } function e2m_day($parameters=array ()) { global$_strings; $g84cdc= (int)$parameters['year']; $n7436f=(int)$parameters['month']; $g628b7= (int)$parameters['day']; if (!(i1665($g84cdc,$n7436f,$g628b7))) { return e2_error404_mode(); } $u09d6c=e2l_get_string( 'pt--nth-day-of-nth-month-of-nth-year', array ('year' => $g84cdc,'month' => $n7436f,'day' => $g628b7) ); $ye6e7d=gmmktime(0,0,0,$n7436f,$g628b7-1,$g84cdc); $a029bd=gmmktime(0,0,0,$n7436f,$g628b7+1,$g84cdc); list ($a8aebd,$n5a7f3)=e2__fruitful_neighbours_with_ymd_($g84cdc,$n7436f,$g628b7); $xa6d40='e2m_day'; if ($a8aebd){ $db3b32['prev-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($a8aebd) ); $db3b32['prev-jump?'] = (bool) (gmdate('Y/m/d',$ye6e7d)!=gmdate('Y/m/d',$a8aebd)); $db3b32['prev-title']=e2l_get_string( 'gs--nth-day-of-nth-month-of-nth-year', array ( 'year' => gmdate('Y',$a8aebd),'month' => gmdate('n',$a8aebd),'day' => gmdate('j',$a8aebd), ) ); } if ($n5a7f3){ $db3b32['next-href']=x83c8( $xa6d40,e2__parameters_with_timestamp_($n5a7f3) ); $db3b32['next-jump?'] = (bool) (gmdate('Y/m/d',$a029bd)!=gmdate('Y/m/d',$n5a7f3)); $db3b32['next-title']=e2l_get_string( 'gs--nth-day-of-nth-month-of-nth-year', array ( 'year' => gmdate('Y',$n5a7f3),'month' => gmdate('n',$n5a7f3),'day' => gmdate('j',$n5a7f3), ) ); } $db3b32['timeline?']=false; $db3b32['this-title']=$u09d6c; $r2cb9d=[ 'title' => $u09d6c, 'heading' => $u09d6c, 'pages' => $db3b32, 'month-days' => e2_pack_month_days_with_ymd_($g84cdc,$n7436f,$g628b7), ]; $result=rf9fb($g84cdc,$n7436f,$g628b7); $result=array_reverse($result); $o15514=we852(); foreach($result as $d8ce4b => $w39a37){ if (yb44b($w39a37,$o15514)) { $w39a37['_']['_id']=$w39a37['ID']; $w39a37['_']['_ord']=$d8ce4b; $w39a37['_']['_ord_max']=count($result)-1; $z4358b[] = o6791($w39a37); } } if(count($z4358b)) { $r2cb9d['notes']=$z4358b; } else { $r2cb9d['nothing']=$_strings['gs--no-such-notes']; } return $r2cb9d; } function m71d9(){ global$_config; $z4358b=null; if(CACHE_FULLLIST and is_file(CACHE_FILENAME_FULLLIST)) { $z4358b=@unserialize(file_get_contents(CACHE_FILENAME_FULLLIST)); if(Log::$ned2b5)__log('Retrieving full notes list from cache...'); } if (!is_array($z4358b)) { if(Log::$ned2b5)__log('Retrieving full notes list from database...'); u0738( "SELECT `ID`, `Title`, `Stamp`, `LastModified`, `Offset`, `IsDST`, ". "`IsFavourite`, `IsPublished`, `IsVisible`, `SourceNoteURL`, `OriginalAlias` ". "FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished` = 1 ". w6f32(). "ORDER BY `Stamp`", 'get full notes list' ); $result=d0d6b(); $z4358b=o28df($result); if(CACHE_FULLLIST)k6e52(CACHE_FILENAME_FULLLIST,serialize($z4358b)); } return $z4358b; } function e2m_everything($parameters=array ()) { global$_strings; $z4358b=m71d9(); $s1f525=count($z4358b); $u09d6c=e2l_get_string('pt--n-posts', array ('number' => $s1f525)); $r2cb9d=[ 'title' => $u09d6c, 'heading' => $u09d6c, ]; if(count($z4358b)) { $r2cb9d['notes-list']=$z4358b; } else { $r2cb9d['nothing']=$_strings['gs--no-notes']; } return $r2cb9d; } function e2m_sitemap_xml($parameters=array ()) { global$_config; $z4358b=m71d9(); if (@$_config['dev_xml_as_text']) { header('Content-Type: text/plain'); } else { header('Content-type: application/xml; charset=utf-8'); } echo '<?xml version="1.0" encoding="UTF-8"?>'."\r\n"; echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\r\n"; if(count($z4358b)) { $u20612=@$z4358b[0]['last-modified']; echo '<url>'."\r\n"; echo '<loc>'. x83c8('e2m_frontpage', array ('page' => 1)) .'</loc>'."\r\n"; echo '<lastmod>'; echo gmdate('Y-m-d\TH:i:s\Z',$u20612[0]); echo '</lastmod>'."\r\n"; echo '<changefreq>hourly</changefreq>'; echo '</url>'."\r\n"; foreach ($z4358b as $saad65){ echo '<url>'."\r\n"; echo '<loc>'; echo $saad65['href']; echo '</loc>'."\r\n"; echo '<lastmod>'; echo gmdate('Y-m-d\TH:i:s\Z',$saad65['last-modified'][0]); echo '</lastmod>'."\r\n"; echo '</url>'."\r\n"; } } echo '</urlset>'."\r\n"; die; } function e2_pack_month_days_with_ymd_($g84cdc,$n7436f,$g628b7){ $ta6933=h5a2f('t',gmmktime(0,0,0,$n7436f,1,$g84cdc),j3211()); $zb2442=lcc02('start'); $s8dbc7=lcc02('end'); if ( $g84cdc .'/'. $n7436f == h5a2f('Y/n',$zb2442['stamp'],$zb2442['timezone']) ) { $f42eb4=h5a2f('d',$zb2442['stamp'],$zb2442['timezone']); } else { $f42eb4=1; } if ( $g84cdc .'/'. $n7436f == qa846('Y/n',time()) ) { $kd5f50=qa846('d',time()); } else { $kd5f50=$ta6933; } $me4602=iae09($g84cdc,$n7436f); for ($f865c0=1; $f865c0 <= $ta6933; ++ $f865c0){ $a7f769=gmmktime(0,0,0,$n7436f,$f865c0,$g84cdc); $y271c1[$f865c0] = array ( 'number' => $f865c0, 'start-time' => array ($a7f769,j3211()), 'href' => gmdate('Y/m/d/',$a7f769), 'this?' => (bool) ($f865c0==$g628b7), 'real?' => $f865c0 >= $f42eb4 and $f865c0 <= $kd5f50, 'fruitful?' => @in_array(gmdate('d',$a7f769),$me4602), ); } return $y271c1; } function i1665($g84cdc,$n7436f=false,$g628b7=false){ $zb2442=lcc02('start'); if ($zb2442===false){ return false; } $sc1f1e=h5a2f('Y',$zb2442['stamp'],$zb2442['timezone']); $vebeb3=qa846('Y',time()); if ($n7436f===false){ return (bool) ( $g84cdc >= $sc1f1e and $g84cdc <= $vebeb3 ); } else { $d782fc=h5a2f('n',$zb2442['stamp'],$zb2442['timezone']); $v13dd1=qa846('n',time()); if ($g628b7===false){ return (bool) ( $n7436f >= 1 and $n7436f <= 12 and ( ($g84cdc > $sc1f1e and $g84cdc < $vebeb3) or ($g84cdc==$sc1f1e and $n7436f >= $d782fc) or ($g84cdc==$vebeb3 and $n7436f <= $v13dd1) ) ); } else { $d7a9c0=h5a2f('j',$zb2442['stamp'],$zb2442['timezone']); $e23209=qa846('j',time()); if(1){ return (bool) ( checkdate($n7436f,$g628b7,$g84cdc) and ( ($g84cdc > $sc1f1e and $g84cdc < $vebeb3) or ($g84cdc==$sc1f1e and $n7436f > $d782fc) or ($g84cdc==$sc1f1e and $n7436f==$d782fc and $g628b7 >= $d7a9c0) or ($g84cdc==$vebeb3 and $n7436f < $v13dd1) or ($g84cdc==$vebeb3 and $n7436f==$v13dd1 and $g628b7 <= $e23209) ) ); } } } } function e2__fruitful_neighbours_with_ymd_($q41529,$t6f8f5=false,$r8277e=false){ global$_db,$_config; list ($u3d2fa,$z9468c)=z5273($q41529,$t6f8f5,$r8277e); $wada4b=SECONDS_IN_A_DAY; if ($r8277e===false)$wada4b=SECONDS_IN_A_MONTH; if ($t6f8f5===false)$wada4b=SECONDS_IN_A_YEAR; $xbf025=$p8dc98=null; u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']. "Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". "AND `Stamp` < '". ($z9468c-$wada4b) ."' ". w6f32(we852()). "ORDER BY Stamp DESC", 'get previous fruitful neighbour with ymd' ); while ($s6438c=mysqli_fetch_array($_db['result'],MYSQLI_ASSOC)) { list ($g84cdc,$n7436f,$g628b7)=explode('/', h5a2f('Y/n/j',$s6438c['Stamp'],l0923($s6438c)) ); $n7474d=$q41529*10000 + ($t6f8f5? ($t6f8f5*100):0) + ($r8277e? $r8277e:0); $bbd8da=$g84cdc*10000 + ($t6f8f5? ($n7436f*100):0) + ($r8277e? $g628b7:0); if ($bbd8da < $n7474d){ $xbf025=gmmktime(0,0,0,$n7436f,$g628b7,$g84cdc); break; } } u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']. "Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". "AND `Stamp` > '". ($u3d2fa+$wada4b) ."' ". w6f32(we852()). "ORDER BY Stamp", 'get next fruitful neighbour with ymd' ); while ($s6438c=mysqli_fetch_array($_db['result'],MYSQLI_ASSOC)) { list ($g84cdc,$n7436f,$g628b7)=explode('/', h5a2f('Y/n/j',$s6438c['Stamp'],l0923($s6438c)) ); $n7474d=$q41529*10000 + ($t6f8f5? ($t6f8f5*100):0) + ($r8277e? $r8277e:0); $bbd8da=$g84cdc*10000 + ($t6f8f5? ($n7436f*100):0) + ($r8277e? $g628b7:0); if ($bbd8da > $n7474d){ $p8dc98=gmmktime(0,0,0,$n7436f,$g628b7,$g84cdc); break; } } return [$xbf025,$p8dc98]; } function e2__parameters_with_timestamp_($k96b8c){ list ( $parameters['year'], $parameters['month'], $parameters['day'] ) = explode('/',gmdate('Y/m/d',$k96b8c)); return$parameters; } function o28df($pc2d18,$g84cdc=false,$n7436f=false){ $c229c3=0; $z4358b=array(); $qf09d8=''; $z4358b=array(); $icc73f=array(); foreach ($pc2d18 as $d8ce4b => $w39a37){ $saad65['href'] = x83c8('e2m_note', array ('*note' => $w39a37)); $saad65['time'] = array ((int)min($w39a37['Stamp'],time()), l0923($w39a37)); $saad65['last-modified'] = array ((int)min($w39a37['LastModified'],time()), l0923($w39a37)); $saad65['favourite?'] = (bool) ($w39a37['IsFavourite'] && $w39a37['IsPublished']); $saad65['visible?'] = yb44b($w39a37); if(array_key_exists('SourceNoteURL',$w39a37) and @$w39a37['SourceNoteURL']!=''){ $saad65['href']=$w39a37['SourceNoteURL']; $saad65['href-original']=$w39a37['SourceNoteURL']; } if ( ($g84cdc and $n7436f and ( ((int)$g84cdc) .'/'. ((int)$n7436f) == h5a2f('Y/n',$w39a37['Stamp'],l0923($w39a37)) )) or ($g84cdc and !$n7436f and ( (int)$g84cdc == h5a2f('Y',$w39a37['Stamp'],l0923($w39a37)) )) or (!$g84cdc and !$n7436f) ) { array_unshift($z4358b,$saad65); array_unshift($icc73f,str_replace("\n",' ',$w39a37['Title'])); } } $m789f1=implode("\n",$icc73f); $m789f1=u6f10(htmlspecialchars($m789f1,ENT_NOQUOTES,HSC_ENC)); $icc73f=explode("\n",$m789f1); foreach ($z4358b as $d8ce4b => $t9e366){ $z4358b[$d8ce4b]['title']=$icc73f[$d8ce4b]; } return $z4358b; } function a9737($q41529){ global$_config; list ($b5a603,$kc2b31)=z5273($q41529); u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". "AND `Stamp` BETWEEN '". $b5a603. "' AND '". $kc2b31 ."' ". w6f32(we852()), 'get all notes for the year '. $q41529 .' to list months with notes' ); $result=d0d6b(); $pda36c=array(); foreach($result as $m65afd){ if ( ((int)$q41529) == h5a2f('Y',$m65afd['Stamp'],l0923($m65afd)) ) { $pda36c[] = (int)h5a2f('n',$m65afd['Stamp'],l0923($m65afd)); } } $pda36c=@array_unique($pda36c); sort($pda36c); return $pda36c; } function iae09($q41529,$t6f8f5){ global$_config; list ($dfc6b2,$q10df4)=z5273($q41529,$t6f8f5); u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". "AND `Stamp` BETWEEN '". $dfc6b2 ."' AND '". $q10df4 ."' ". w6f32(we852()), 'get all notes for the month '.$t6f8f5.' of the year '. $q41529 .' to list days with notes' ); $result=d0d6b(); $q44fde=array(); foreach($result as $m65afd){ if ( ((int)$q41529) .'/'. ((int)$t6f8f5) == h5a2f('Y/n',$m65afd['Stamp'],l0923($m65afd)) ) { $q44fde[] = (int)h5a2f('j',$m65afd['Stamp'],l0923($m65afd)); } } $q44fde=@array_unique($q44fde); sort($q44fde); return $q44fde; } function lcc02($r92c58){ global$_config; $v8b7af='p1'; if (!we852()) { $v8b7af='p1v1'; } $xd29bb=CACHES_FOLDER.$r92c58 .'-stamp-'. $v8b7af .'.e2time.psa'; if(CACHE_EDGE_TIMEINFO and is_file($xd29bb)) { $r2cb9d=@unserialize(file_get_contents($xd29bb)); } if(is_array($r2cb9d)) { return $r2cb9d; } else { $r2cb9d=array ( 'stamp' => time(), 'timezone' => g5c05(), ); if ($r92c58=='start'){ u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". w6f32(we852()). "ORDER BY `Stamp` LIMIT 1", 'get blog start timestamp' ); } elseif ($r92c58=='end'){ u0738( "SELECT `Stamp`, `Offset`, `IsDST` ". "FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ". w6f32(we852()). "ORDER BY `Stamp` DESC LIMIT 1", 'get blog latest note timestamp' ); } $result=d0d6b(); if(count($result)) { $r2cb9d=array ( 'stamp' => $result[0]['Stamp'], 'timezone' => l0923($result[0]), ); if(CACHE_EDGE_TIMEINFO)k6e52($xd29bb,serialize($r2cb9d)); return $r2cb9d; } return $r2cb9d; } } define('CACHE',true); define('CACHE_NOTES',CACHE and true); define('CACHE_NOTES_COMMENTS',CACHE and true); define('CACHE_POPULAR',CACHE and true); define('CACHE_HOT',CACHE and true); define('CACHE_FAVS',CACHE and true); define('CACHE_TAGS',CACHE and true); define('CACHE_FAVTAGS',CACHE and true); define('CACHE_NOTES_COUNTS',CACHE and true); define('CACHE_EDGE_TIMEINFO',CACHE and true); define('CACHE_FRONTPAGE',CACHE and true); define('CACHE_FRONTPAGE_FEED',CACHE and true); define('CACHE_FULLLIST',CACHE and true); define('CACHE_DRAFTS',CACHE and true); define('CACHE_DRAFTS_ALIAS_USE_COUNTS',CACHE and true); define('CACHE_LASTMODIFIEDS',CACHE and true); define('CACHE_FILENAMES_NOTES',CACHES_FOLDER.'note-*.ctree.psa'); define('CACHE_FILENAMES_NOTES_COMMENTS', CACHES_FOLDER.'note-*-comments.ctree.psa' ); define('CACHE_FILENAMES_NOTES_COMMENTS_AUTHOR', CACHES_FOLDER.'note-*-comments-author.ctree.psa' ); define('CACHE_FILENAMES_NOTES_COUNTS',CACHES_FOLDER.'notes-count-*.txt'); define('CACHE_FILENAMES_EDGE_TIMEINFO',CACHES_FOLDER.'*.e2time.psa'); define('CACHE_FILENAME_POPULAR',CACHES_FOLDER.'popular.ctree.psa'); define('CACHE_FILENAME_POPULAR_EXPIRES',CACHES_FOLDER.'popular-expires.txt'); define('CACHE_FILENAME_HOT',CACHES_FOLDER.'hot.ctree.psa'); define('CACHE_FILENAME_HOT_EXPIRES',CACHES_FOLDER.'hot-expires.txt'); define('CACHE_FILENAME_FAVS',CACHES_FOLDER.'favourites.ctree.psa'); define('CACHE_FILENAME_TAGS',CACHES_FOLDER.'tags.ctree.psa'); define('CACHE_FILENAME_TAGS_FULL',CACHES_FOLDER.'tags-full.ctree.psa'); define('CACHE_FILENAME_TAGS_AUTHOR',CACHES_FOLDER.'tags-author.ctree.psa'); define('CACHE_FILENAME_TAGS_AUTHOR_FULL',CACHES_FOLDER.'tags-author-full.ctree.psa'); define('CACHE_FILENAME_FAVTAGS',CACHES_FOLDER.'favtags.ctree.psa'); define('CACHE_FILENAME_FRONTPAGE',CACHES_FOLDER.'frontpage.ctree.psa'); define('CACHE_FILENAME_FRONTPAGE_AUTHOR',CACHES_FOLDER.'frontpage-author.ctree.psa'); define('CACHE_FILENAME_FRONTPAGE_FEED',CACHES_FOLDER.'frontpage-feed.psa'); define('CACHE_FILENAME_FULLLIST',CACHES_FOLDER.'notes-list.ctree.psa'); define('CACHE_FILENAME_DRAFTS',CACHES_FOLDER.'drafts.psa'); define('CACHE_FILENAME_DRAFTS_ALIAS_USE_COUNTS',CACHES_FOLDER.'drafts-auc.psa'); define('CACHE_FILENAME_LASTMODIFIEDS',CACHES_FOLDER.'last-modifieds-by-id.psa'); function e2s_sync(){ e2_drop_all_kinds_of_cache(); die ('All caches clean.'); } function e2_note_cache_filename_with_id_($xb80bb){ return str_replace('*',$xb80bb,CACHE_FILENAMES_NOTES); } function e2_drop_caches_for_note_($y21158){ if(is_numeric($y21158)) { if(Log::$ned2b5)__log('Caches: Drop caches for note id '. $y21158); @unlink(e2_note_cache_filename_with_id_($y21158)); @unlink(e2_note_cache_filename_with_id_($y21158 .'-comments')); @unlink(e2_note_cache_filename_with_id_($y21158 .'-comments-author')); } else { jc5a6(CACHE_FILENAMES_NOTES); jc5a6(CACHE_FILENAMES_NOTES_COMMENTS); jc5a6(CACHE_FILENAMES_NOTES_COMMENTS_AUTHOR); } le2f1(); x22e7(); @unlink(CACHE_FILENAME_HOT); @unlink(CACHE_FILENAME_POPULAR); @unlink(CACHE_FILENAME_FRONTPAGE); @unlink(CACHE_FILENAME_FRONTPAGE_AUTHOR); @unlink(CACHE_FILENAME_FRONTPAGE_FEED); @unlink(CACHE_FILENAME_FULLLIST); @unlink(CACHE_FILENAME_TAGS); @unlink(CACHE_FILENAME_TAGS_FULL); @unlink(CACHE_FILENAME_TAGS_AUTHOR); @unlink(CACHE_FILENAME_TAGS_AUTHOR_FULL); @unlink(CACHE_FILENAME_LASTMODIFIEDS); } function i7996(){ if(Log::$ned2b5)__log('Caches: Drop notes caches'); e2_drop_caches_for_note_(null); } function le2f1(){ if(Log::$ned2b5)__log('Caches: Drop notes counts cache'); jc5a6(CACHE_FILENAMES_NOTES_COUNTS); } function x22e7(){ if(Log::$ned2b5)__log('Caches: Drop egde time info cache'); jc5a6(CACHE_FILENAMES_EDGE_TIMEINFO); } function e2_drop_all_kinds_of_cache(){ if(Log::$ned2b5)__log('Caches: Drop all kinds of caches'); jc5a6(CACHES_FOLDER.'*'); return true; } define('OLBA_SPECIAL_CHAR',"\x1"); define('OLBA_SPECIAL_SEQUENCE_LENGTH',6); function udb82($p139c8=null){ global$_template,$_config,$settings; if ($p139c8===null)$p139c8=@$settings['template']; $u1b14d=null; $ja5fca=null; $u00e30=null; $w37c8a=null; $maf10b=array(); $hd9ecb=$p139c8; if ($hd9ecb!==null){ while (1){ if(Log::$ned2b5)__log('Prepare theme "'. $hd9ecb .'"'); $t620f7=TEMPLATES_FOLDER.$hd9ecb .'/'; if ( !is_dir($t620f7) or !is_file($t620f7 .'/theme-info.php') ) { if(Log::$ned2b5)__log('Theme "'. $hd9ecb .'" not found, using default theme "'. DEFAULT_TEMPLATE .'"'); $hd9ecb=DEFAULT_TEMPLATE; $t620f7=TEMPLATES_FOLDER.$hd9ecb .'/'; } array_push($maf10b,$t620f7); $l38226=include $t620f7 .'/theme-info.php'; $w4e502[$t620f7]=$l38226; if(array_key_exists('max_image_width',$l38226)) { if ($u1b14d===null){ $u1b14d=$l38226['max_image_width']; } } if(array_key_exists('meta_viewport',$l38226)) { if ($ja5fca===null){ $ja5fca=$l38226['meta_viewport']; } } if(array_key_exists('supports_dark_mode',$l38226)) { if ($u00e30===null){ $u00e30=$l38226['supports_dark_mode']; } } if(array_key_exists('use_likely_light',$l38226)) { if ($w37c8a===null){ $w37c8a=$l38226['use_likely_light']; } } if(array_key_exists('based_on',$l38226)) { $hd9ecb=$l38226['based_on']; } else { break; } } } if ($u1b14d===null){ $u1b14d=$_config['max_image_width']; } if ($ja5fca===null)$ja5fca=''; if ($u00e30===null)$u00e30=false; if ($w37c8a===null)$w37c8a=false; $t620f7=SYSTEM_TEMPLATE_FOLDER; array_push($maf10b,$t620f7); $_template['name']=$p139c8; $_template['max_image_width']=$u1b14d; $_template['meta_viewport']=$ja5fca; $_template['supports_dark_mode']=$u00e30; $_template['use_likely_light']=$w37c8a; $_template['stack']=$maf10b; $_template['infos']=$w4e502; }; function f53ee($sd436e){ global$content; if (!isset ($_olba_includes))$_olba_includes=0; ++ $_olba_includes; if(Log::$ned2b5)__log('Eat "'. $sd436e .'"'); include $sd436e; } function af671($f6a992){ return ( OLBA_SPECIAL_CHAR. str_pad($f6a992,OLBA_SPECIAL_SEQUENCE_LENGTH,'0',STR_PAD_LEFT). OLBA_SPECIAL_CHAR ); } function tab71($vb0689){ static $f6a992=0; uf1da($vb0689,'_olba_placeholders'); echo af671($f6a992 ++); } function y326f($e78e62){ global$_olba_placeholders; foreach($_olba_placeholders as $f6a992 => $w2063c){ $xe068c=af671($f6a992); $d5e0bd=strpos($e78e62,$xe068c); $sf5300=q166b($w2063c,true); if ($d5e0bd!==false){ $e78e62=substr_replace( $e78e62,$sf5300,$d5e0bd,strlen($xe068c) ); } else { break; } } return $e78e62; } function a6a97($b52678){ if(is_dir(EXTRAS_FOLDER)) { $i71cae=EXTRAS_FOLDER.$b52678 .'.tmpl.php'; if(is_file($i71cae)) { f53ee($i71cae); } } return ''; } function q166b($b52678,$we70c4=false){ global$_template,$_olba_includes; $i71cae='templates/'. $b52678 .'.tmpl.php'; if ($sd436e=e2o__usable_file_with_basename_($i71cae)) { if ($we70c4){ ob_start(); } f53ee($sd436e); if ($we70c4){ $r2cb9d=ob_get_contents(); ob_end_clean(); return $r2cb9d; } } else { ob_end_clean(); throw new AeOlbaTemplateMissingException('Missing: '. $i71cae); } } function gbc21(){ global$_config; if ( @$_config['raw_template_data'] or @$_config['raw_template_data_with_param'] and array_key_exists('raw',$_GET) ) { $v3f7d9='raw'; } else { $v3f7d9='main'; } return q166b($v3f7d9,true); } function hd4c1($w45ac4){ uf1da($w45ac4 .'.css','_olba_used_stylesheets'); } function xd00a($s3205c){ uf1da($s3205c .'.js','_olba_used_scripts'); } function v16f0($be8acc){ foreach (array (SYSTEM_LIBRARY_FOLDER,USER_LIBRARY_FOLDER) as $a71379){ foreach(glob($a71379.$be8acc .'/*') as $d8c7dd){ $iabf77=pathinfo($d8c7dd,PATHINFO_EXTENSION); if ($iabf77=='js'){ uf1da($d8c7dd,'_olba_used_scripts'); } if ($iabf77=='css'){ uf1da($d8c7dd,'_olba_used_stylesheets'); } } } } function k94dd(){ global$_template,$_config,$settings; if ($ge1260=@opendir(TEMPLATES_FOLDER)) { while (false !== ($x1f769=readdir($ge1260))) { if(is_dir(TEMPLATES_FOLDER. $x1f769) and $x1f769!='.' and $x1f769!='..'){ if(is_file(TEMPLATES_FOLDER.$x1f769 .'/theme-info.php')) { $gccf6b[$x1f769]=TEMPLATES_FOLDER.$x1f769 .'/'; } } } closedir($ge1260); } $d10ae9=array(); $e2e3a2=1000; foreach ($gccf6b as $vb0689 => $y85114){ $l38226=include $y85114 .'theme-info.php'; $yc2657=@$l38226['display_name']; if (!$yc2657) continue; if(is_array($yc2657)) { if(array_key_exists($settings['language'],$yc2657)) { $yc2657=$yc2657[$settings['language']]; } else { $yc2657=array_shift($yc2657); } } $f6a992=@$l38226['index'] or $f6a992=$e2e3a2 ++; $o62848=@$l38226['colors']; if (!$o62848)$o62848=array ( 'background' => 'transparent', 'headings' => 'rgba(128,128,128,.2)', 'text' => 'rgba(128,128,128,.2)', 'link' => 'rgba(128,128,128,.2)', ); $h16e25=(bool) ($vb0689==$_template['name']); if ($h16e25){ $ucd143=x83c8('e2m_theme_preview', array ('theme' => '')); } else { $ucd143=x83c8('e2m_theme_preview', array ('theme' => $vb0689)); } $d10ae9[$f6a992] = array ( 'name' => $vb0689, 'display-name' => $yc2657, 'colors' => $o62848, 'current?' => $h16e25, 'preview-url' => $ucd143, 'supports-dark-mode?' => $l38226['supports_dark_mode'], ); } ksort($d10ae9); return $d10ae9; } function b1492($j435ed){ return e2o__usable_file_with_basename_('images/'. $j435ed); } function kf42c($mb1197){ return file_get_contents(e2o__usable_file_with_basename_('images/'. $mb1197 .'.svg')); } function h576f($w45ac4){ global$_template; $o954eb='styles/'. $w45ac4 .'.css'; $y95aa1=array(); foreach($_template['stack'] as $t620f7){ if(is_file($j435ed=$t620f7.$o954eb)) { $y95aa1[] = $j435ed; } if ( array_key_exists('reset_styles',$_template['infos'][$t620f7]) and in_array($w45ac4,$_template['infos'][$t620f7]['reset_styles']) ) { break; } } $y95aa1=array_reverse($y95aa1); } function l37ca(){ global$_olba_used_stylesheets,$_template; if (!isset ($_olba_used_stylesheets)) return; $_olba_used_stylesheets=array_unique($_olba_used_stylesheets); $qc7f50=array(); foreach($_olba_used_stylesheets as $w45ac4){ if(is_file($w45ac4)) { $qc7f50[] = $w45ac4; continue; } if(is_file($j435ed=USER_FOLDER .'js/'. $w45ac4)) { $qc7f50[] = $j435ed; } $o954eb='styles/'. $w45ac4; $y95aa1=array(); foreach($_template['stack'] as $t620f7){ if(is_file($j435ed=$t620f7.$o954eb)) { $y95aa1[] = $j435ed; } if ( array_key_exists('reset_styles',$_template['infos'][$t620f7]) and in_array($w45ac4,$_template['infos'][$t620f7]['reset_styles']) ) { break; } } $y95aa1=array_reverse($y95aa1); $qc7f50=array_merge($qc7f50,$y95aa1); } foreach ($qc7f50 as $d8ce4b => $t9e366){ $jbc7b3=stat($t9e366); $qc7f50[$d8ce4b].='?'. $jbc7b3['mtime']; } return $qc7f50; } function o4753(){ global$_olba_used_scripts; if (!isset ($_olba_used_scripts)) return; $_olba_used_scripts=array_unique($_olba_used_scripts); $bd6c58=array(); foreach($_olba_used_scripts as $s3205c){ if ( substr($s3205c,0,7)=='http://' or substr($s3205c,0,8)=='https://' or substr($s3205c,0,2)=='//' ){ $bd6c58[] = $s3205c; continue; } if(is_file($s3205c)) { $bd6c58[] = $s3205c; continue; } if(is_file($v9d679=USER_FOLDER .'js/'. $s3205c)) { $bd6c58[] = $v9d679; } $o954eb='js/'. $s3205c; if ($v9d679=e2o__usable_file_with_basename_($o954eb)) { $bd6c58[] = $v9d679; } } foreach ($bd6c58 as $d8ce4b => $t9e366){ $jbc7b3=stat($t9e366); if ($jbc7b3['mtime']) { $bd6c58[$d8ce4b].='?'. $jbc7b3['mtime']; } } return $bd6c58; } function a57ad($ob268d){ if (!is_array($ob268d)) return; foreach ($ob268d as $q2a304){ if(substr($q2a304, -3)=='.js'){ xd00a(substr($q2a304,0, -3)); } if(substr($q2a304, -4)=='.css'){ hd4c1(substr($q2a304,0, -4)); } } } function uf1da($w2063c,$cf1f71){ if (!isset ($GLOBALS[$cf1f71])) { $GLOBALS[$cf1f71] = array ($w2063c); } else { $GLOBALS[$cf1f71][] = $w2063c; } } function e2o__usable_file_with_basename_($o954eb){ global$_template; if (!isset ($_template))udb82(); foreach($_template['stack'] as $t620f7){ if(is_file($j435ed=$t620f7.$o954eb)) { return $j435ed; } } return ''; } function e2m_theme_preview($parameters){ global$_lang,$_strings,$_superconfig,$_template; if (@$_superconfig['disallow_themes_preview']) { return e2_error404_mode(); } if($parameters['theme']==$_template['name']) { e2_go_to(x83c8('e2m_theme_preview', array ('theme' => ''))); } if($parameters['theme']) { udb82($parameters['theme']); } $m75725=$_lang; if (!is_file($d8c7dd='system/preview/'. $m75725 .'.php')) { $m75725=$_strings['--secondary-language']; $d8c7dd='system/preview/'. $m75725 .'.php'; } if (!is_file($d8c7dd='system/preview/'. $m75725 .'.php')) { $d8c7dd='system/preview/'. DEFAULT_LANGUAGE .'.php'; } $we70c4=include $d8c7dd; return $we70c4; } define('SEARCH_EXTRA_PREFIX','Rose'); define('SEARCH_LIMIT',20); define('SEARCH_SNIPPETS_LIMIT',20); define('SEARCH_USE_ROSE',1); define('SEARCH_USE_MYSQL',1); define('BSI_SELECT_PORTION',10); define('BSI_GIVE_UP_TIMEOUT',10); define('BSI_UNLOCK_TIMEOUT',10); use S2\Rose\Storage\Exception\EmptyIndexException; use S2\Rose\Storage\Database\PdoStorage; use S2\Rose\Stemmer\PorterStemmerEnglish; use S2\Rose\Stemmer\PorterStemmerRussian; use S2\Rose\Indexer; use S2\Rose\Entity\Indexable; use S2\Rose\Entity\Query; use S2\Rose\Finder; use S2\Rose\SnippetBuilder; function e2m_found($parameters=array ()) { global$_strings,$_config,$settings,$full_blog_url; $parameters['query']=trim($parameters['query']); $b1b1cc=$parameters['query']; if (!$b1b1cc){ return array ( 'title' => $_strings['pt--search-query-empty'], 'heading' => $_strings['pt--search'], 'nothing' => $_strings['gs--search-query-empty'], ); } $b11128=false; try { u0738( "SELECT * FROM `". $_config['db_table_prefix']."Keywords` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `Keyword`='". a7928($b1b1cc) ."'", 'get tags matching the search query' ); $cfa816=d0d6b(); if (isset ($cfa816[0]['ID'])) { $b11128=array ( 'href' => x83c8('e2m_tag', array ('*tag' => $cfa816[0])), 'name' => htmlspecialchars($b1b1cc,ENT_NOQUOTES,HSC_ENC), ); } } catch (AeMySQLException $e){ b12f6($e,'Could not get tags matching the search query'); } $c4dd42=l163d(' ',$parameters['query']); if(SEARCH_USE_ROSE){ $dfce9c=new PorterStemmerRussian(new PorterStemmerEnglish()); foreach ($c4dd42 as $d8ce4b => $t9e366){ $c4dd42[$d8ce4b]=$dfce9c -> stemWord($c4dd42[$d8ce4b]); } } $g8e830=array(); $b5d481=we852(); if(SEARCH_USE_ROSE){ try { $fddece=a476c(); $q5b9bd=new Finder($fddece,$dfce9c); $q5b9bd -> setHighlightTemplate('<mark>%s</mark>'); $lf7de9=new Query($b1b1cc); $lf7de9 -> setLimit(SEARCH_LIMIT); $resultSet=$q5b9bd -> find($lf7de9); foreach($resultSet -> getFoundExternalIds() as $w0e684){ if ($w0e684[0]=='n'){ $y21158=substr($w0e684,1); $saad65=i4627($y21158); if (!empty ($_config['search_favourites_boost'])) { if ($saad65['IsFavourite']) { $resultSet->setRelevanceRatio($w0e684,$_config['search_favourites_boost']); } } } } $snippetBuilder=new SnippetBuilder($dfce9c); $snippetBuilder -> setSnippetLineSeparator('  '); $snippetBuilder -> attachSnippets($resultSet, function (array $dbf516){ $result=array(); foreach(array_slice($dbf516,0,SEARCH_SNIPPETS_LIMIT) as $w0e684){ if ($w0e684[0]=='n'){ $y21158=substr($w0e684,1); $w39a37=@i4627($y21158); if ($w39a37){ $w39a37['_']['_id']=$y21158; $saad65=o6791($w39a37); $result[$w0e684]=$saad65['text']; } } } return$result; }); foreach($resultSet -> getItems() as $w0e684 => $r447b7){ if ($w0e684[0]=='n'){ $y21158=substr($w0e684,1); $saad65=i4627($y21158); $saad65['_']['_id']=$y21158; $saad65['_']['_srprovider']='rose'; $saad65['_']['_rose_relevance']=$r447b7 -> getRelevance(); $saad65['_']['_rose_title']=$r447b7 -> getHighlightedTitle($dfce9c); $saad65['_']['_rose_snippet']=$r447b7 -> getSnippet(); if ($saad65['IsPublished'] and yb44b($saad65,$b5d481)) { $g8e830[] = $saad65; } } } if (@$_config['dev_rose_info']) { $s1e441=print_r($resultSet -> getTrace(),true); } } catch (EmptyIndexException $e){ b12f6($e,'Rose index is empty'); } catch (AeMySQLException $e){ b12f6($e,'Could not do something with the database while working on Rose search results'); } } if(SEARCH_USE_MYSQL){ $n36a38=a7928(preg_quote($b1b1cc)); $web31b=( "SELECT * FROM `". $_config['db_table_prefix']."Notes` n ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 AND MATCH (`Title`, `Text`) AGAINST ('". $n36a38 ."')". w6f32($b5d481). "LIMIT ". SEARCH_LIMIT ); try { u0738( $web31b, 'search using MySQL fulltext search' ); $result=d0d6b(); foreach($result as $d8ce4b => $saad65){ $saad65['_']['_id']=$saad65['ID']; $saad65['_']['_srprovider']='mysql'; $g8e830[] = $saad65; } } catch (AeMySQLException $e){ b12f6($e,'Could not search using MySQL fulltext search'); } } $qfbdf2=array(); $z4358b=array(); $f865c0=0; foreach ($g8e830 as $w39a37){ if (!in_array($w39a37['ID'],$qfbdf2)) { $saad65=o6791($w39a37); if (@$saad65['_']['_rose_title']) { $saad65['title']=$saad65['_']['_rose_title']; } else { $saad65['title']=i4c2d($saad65['title'],$c4dd42); } $saad65['title']=u6f10($saad65['title']); if (@$saad65['_']['_rose_snippet']) { $saad65['text']='<p>'. $saad65['_']['_rose_snippet'] .'</p>'; } else { $a1cb25=$saad65['text']; $a1cb25=preg_replace('/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/i','',$a1cb25); $a1cb25=preg_replace('/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/i','',$a1cb25); $a1cb25=str_replace( array ( '<br>', '<br/>', '<br />', '</h1>', '</h2>', '</h3>', '</h4>', '</h5>', '</h6>', '</p>', '</pre>', '</blockquote>', '</li>', ), ' ', $a1cb25 ); $a1cb25=strip_tags($a1cb25); $gad7ba=array(); $u9cc49=preg_split('/[\\n\(\)\[\]]|[.:;?!](\s|$)/uis',$a1cb25); $j363b1=0; $x02db3=''; foreach ($u9cc49 as $md866f){ $md866f=trim($md866f); if (!$md866f) continue; if (!$x02db3)$x02db3=$md866f; $g870c2=$md866f; $g870c2=i4c2d($g870c2,$c4dd42); if ($g870c2!=$md866f){ $gad7ba[] = u48d8($g870c2); $j363b1 ++; if ($j363b1 > 3) break; } } if(count($gad7ba)) { $saad65['text']='<p>'. implode('  ',$gad7ba) .'</p>'; } else { $saad65['text']='<p>'. $x02db3 .'</p>'; } } $saad65['has-highlighed-thumbs?']=false; if ($y55b55=@$saad65['format-info']['resources-detected']) { $u750fa=b2e82($y55b55); foreach ($u750fa as $d8ce4b => $t9e366){ $u750fa[$d8ce4b]['highlighted?'] = ( strstr($t9e366['original-filename'],$b1b1cc)!==false ); if ($u750fa[$d8ce4b]['highlighted?']) { $saad65['has-highlighted-thumbs?']=true; } } $saad65['thumbs']=$u750fa; } $z4358b[] = $saad65; $qfbdf2[] = $w39a37['ID']; $f865c0 ++; if ($f865c0 >= SEARCH_LIMIT) break; } } $ifbb44=count($z4358b); if ($ifbb44){ $l5cde2=e2l_get_string( 'pt--n-posts', array ('number' => $ifbb44) ); } else { $l5cde2=$_strings['pt--no-posts']; $r2cb9d['nothing']=$_strings['gs--nothing-found']; } if ($f865c0 >= SEARCH_LIMIT){ $l5cde2=$_strings['gs--many-posts']; } if ($b11128){ $r2cb9d['search-related-tag']=$b11128; } $r2cb9d['notes']=$z4358b; $r2cb9d['pages'] = array (); $r2cb9d['title']=$l5cde2 .' '. $_strings['gs--found-for-query'] .': '. htmlspecialchars($b1b1cc,ENT_NOQUOTES,HSC_ENC); $r2cb9d['superheading']=$l5cde2 .' '. $_strings['gs--found-for-query']; $r2cb9d['heading']=$b1b1cc; if (@$s1e441){ $r2cb9d['rose-debug-info']=$s1e441; } return $r2cb9d; } function a5070($parameters){ if(Log::$ned2b5)__log('Search form'); $b1b1cc=trim((string) @$parameters['query']); return [ 'form-action' => x83c8('e2s_search'), 'query' => htmlspecialchars($b1b1cc,ENT_COMPAT,HSC_ENC), ]; } function e2s_search(){ $b1b1cc=@$_POST['query']; $b1b1cc=str_replace('?',urlencode('?'),$b1b1cc); $b1b1cc=str_replace('/',' ',$b1b1cc); $b1b1cc=trim($b1b1cc); $b1b1cc=str_replace(' ','+',$b1b1cc); e2_go_to(x83c8('e2m_found', array ('query' => $b1b1cc))); die; } function e2s_bsi_status(){ global$_db,$_config; echo '<pre>'; echo '/@bsi/step/  Make one step of indexing<br />'; echo '/@bsi/drop/  Drop indexes<br /><br />'; $se1fab=@unserialize(file_get_contents(USER_FOLDER.'indexing.psa')); if (!is_array($se1fab))$se1fab=array ('spent' => '?'); $l34421=$we0d69=$yd1647='?'; try { u0738( "SELECT count(*) c FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsPublished`=1 ", 'count total published notes' ); $s9b207=d0d6b(); $l34421=$s9b207[0]['c']; u0738( "SELECT count(*) c FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsIndexed`=1 AND `IsPublished`=1 ", 'count indexed published notes' ); $s9b207=d0d6b(); $we0d69=$s9b207[0]['c']; $yd1647=round($we0d69/$l34421*100); echo 'Indexed '. $we0d69 .' notes of '. $l34421 .' ('. $yd1647 .'%)<br />'; echo 'Spent '. $se1fab['spent'] .' s (or more)'; } catch (AeMySQLException $e){ b12f6($e,'Could not count some notes'); echo 'DB unaccessible'; } die ('</pre>'); } function e2s_bsi_step(){ global$_db,$_config,$_strings; echo '<pre>'; if($_config['log_bsi']) { Log::$ned2b5=true; if(Log::$ned2b5)v714a('bsi'); } if(Log::$ned2b5)__log('BSI step'); if (!u3b97()) { if(Log::$ned2b5)__log('Not indexing'); die ('Not indexing</pre>'); } $se1fab=@unserialize(file_get_contents(USER_FOLDER.'indexing.psa')); if (!is_array($se1fab))$se1fab=array ('spent' => '?'); if ( !isset ($se1fab['lock']) or $se1fab['lock'] < time() - (BSI_GIVE_UP_TIMEOUT+BSI_UNLOCK_TIMEOUT) ) { if (isset ($se1fab['lock'])) { if(Log::$ned2b5)__log('Indexer: old lock is '. $se1fab['lock']); echo 'Old lock is '. $se1fab['lock'] .'<br />'; } else { echo 'No old lock<br />'; } $se1fab['lock']=time(); if (!@k6e52(USER_FOLDER.'indexing.psa',serialize($se1fab))) { if(Log::$ned2b5)__log('Indexer: cant get a new lock'); die ('Cant get a new lock<br />'); } if(Log::$ned2b5)__log('Indexer: new lock is '. $se1fab['lock']); echo 'New lock is '. $se1fab['lock'] .'<br /><br />'; try { $f865c0=0; $h680a2=0; $uce2fc=v7f78(); $f30d94=false; while ($h680a2 < BSI_GIVE_UP_TIMEOUT){ u0738( "SELECT * FROM `". $_config['db_table_prefix']."Notes` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `IsIndexed`=0 AND `IsPublished`=1 ". "ORDER BY `Stamp` DESC ". "LIMIT ". BSI_SELECT_PORTION, 'get portion of unindexed notes for indexing' ); $s9b207=d0d6b(); if(count($s9b207)) { ++ $f865c0; if(Log::$ned2b5)__log('Indexer: portion '. $f865c0); echo 'Portion '. $f865c0 .'<br />'; foreach ($s9b207 as $oea59a){ if(Log::$ned2b5)__log('Indexer: indexing "'. $oea59a['Title'].'"'); echo 'Indexing: '. $oea59a['Title'] .'<br />'; if (vd2e1($oea59a)) { $oea59a['IsIndexed']='1'; qaa79('Notes',$oea59a); } if($_config['broadcast_on_indexing']) { ueb3b($oea59a); } } $h680a2=round(v7f78()-$uce2fc,3); if(Log::$ned2b5)__log('Indexer: step done '. count($s9b207) .', spent '. $h680a2 .' ms so far'); echo 'Step done '. count($s9b207) .', spent '. $h680a2 .' ms so far<br /><br />'; if(Log::$ned2b5)__log($e78e62); } else { $f30d94=true; break; } } if ($f30d94){ if(Log::$ned2b5)__log('Indexer: indexing complete'); echo 'Indexing complete<br /><br />'; @unlink(USER_FOLDER.'indexing.psa'); } else { echo 'Time out<br />'; unset ($se1fab['lock']); $se1fab['done']=count($s9b207); if ($se1fab['spent']!='?')$se1fab['spent']+=$h680a2; @k6e52(USER_FOLDER.'indexing.psa',serialize($se1fab)); } } catch (AeMySQLException $e){ b12f6($e,'Could not index notes'); if(Log::$ned2b5)__log('Indexer: DB unaccessible'); echo 'DB unaccessible<br />'; } } else { if(Log::$ned2b5)__log('Indexer: locked'); echo 'Locked<br />'; } die ('</pre>'); } function e2s_bsi_drop(){ global$_db,$_config; try { echo '<pre>'; ha521(); echo 'All notes marked for reindexing<br />'; $fddece=a476c(); try { $fddece -> erase(); echo 'Indexes dropped<br />'; } catch (\S2\Rose\Exception\RuntimeException $e){ b12f6($e,'Rose threw RuntimeException'); } c198f(); die ('</pre>'); } catch (AeMySQLException $e){ b12f6($e,'Could not make all notes for reindexing'); die ('<pre>DB unaccessible</pre>'); } } function c198f(){ $se1fab=array(); @k6e52(USER_FOLDER.'indexing.psa',serialize($se1fab)); } function u3b97(){ return (is_file(USER_FOLDER.'indexing.psa')); } function vd2e1($w39a37){ if(Log::$ned2b5)__log('Indexer: index noterec'); static $gf4540=null; try { if ($gf4540===null){ $dfce9c=new PorterStemmerRussian(new PorterStemmerEnglish()); $gf4540=new Indexer(a476c(),$dfce9c); } $o2bfe4=j154e($w39a37['FormatterID'], @$w39a37['Text'],'full-rss'); afc4d($w39a37,$o2bfe4); $a1cb25=strip_tags($o2bfe4['text-final']); $z3e961=new Indexable( 'n'. $w39a37['ID'], $w39a37['Title'], $a1cb25 ); $gf4540 -> index($z3e961); return true; } catch (\Exception $e){ return false; } } function s10fe($xb80bb){ static $gf4540=null; try { if ($gf4540===null){ $dfce9c=new PorterStemmerRussian(new PorterStemmerEnglish()); $gf4540=new Indexer(a476c(),$dfce9c); } return $gf4540 -> removeById('n'. $xb80bb); } catch (\Exception $e){ return false; } } function n713e($ra2f2e){ $e851f5='S2\\Rose\\'; $e32fcc=__DIR__.'/library/rose/'; $tf5a8e=strlen($e851f5); if(strncmp($e851f5,$ra2f2e,$tf5a8e)!==0) return; $pe1cb9=substr($ra2f2e,$tf5a8e); $d8c7dd=$e32fcc.str_replace('\\','/',$pe1cb9).'.php'; if(file_exists($d8c7dd)) require $d8c7dd; } function kd372(){ return array ( 'TOC' => 'Contents', 'WORD' => 'Word', 'FULLTEXT_INDEX' => 'Fulltext', 'KEYWORD_INDEX' => 'Keyword', 'KEYWORD_MULTIPLE_INDEX' => 'KeywordMultiple', ); } function a476c(){ global$_config,$settings; static $x88131=null; if ($x88131===null and SEARCH_USE_ROSE){ $pcf66e=new \PDO( 'mysql:'. 'host='. $settings['db']['server'] .';'. 'dbname='. $settings['db']['name'], $settings['db']['user_name'], iee85($settings['db']['passw']) ); $x2af72=$pcf66e -> getAttribute(\PDO::ATTR_SERVER_VERSION); $q84bea=version_compare($x2af72,'5.5.3','>=')?'utf8mb4':'utf8'; $pcf66e -> exec('SET NAMES '.$q84bea); $pcf66e -> setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $x44b61=kd372(); $x88131=new PdoStorage( $pcf66e, $_config['db_table_prefix'].SEARCH_EXTRA_PREFIX, array ( PdoStorage::TOC => $x44b61['TOC'], PdoStorage::WORD => $x44b61['WORD'], PdoStorage::FULLTEXT_INDEX => $x44b61['FULLTEXT_INDEX'], PdoStorage::KEYWORD_INDEX => $x44b61['KEYWORD_INDEX'], PdoStorage::KEYWORD_MULTIPLE_INDEX => $x44b61['KEYWORD_MULTIPLE_INDEX'], ) ); } return $x88131; } function i4c2d($a1cb25,$c4dd42){ foreach ($c4dd42 as $o2510c){ if ($o2510c=='-') continue; $o2510c=preg_quote($o2510c,'/'); $o2510c=str_replace('','[]',$o2510c); $o2510c=str_replace('','[]',$o2510c); $a1cb25=preg_replace('/(?<=^|\W)('.$o2510c.'[\w\p{M}]*)/iu','<mark>$1</mark>',$a1cb25); } $a1cb25=str_replace('</mark><mark>',' ',$a1cb25); $a1cb25=str_replace('</mark> <mark>',' ',$a1cb25); return $a1cb25; } function u48d8($w341be){ $ge05fe=mb_strtoupper(mb_substr($w341be,0,1)); return $ge05fe.mb_substr($w341be,1); } function ha521(){ global$_config; u0738( "UPDATE `". $_config['db_table_prefix']."Notes` ". "SET `IsIndexed`=0 ". "WHERE `SubsetID`=". $_config['db_table_subset'], 'mark all notes for reindexing' ); } function e2_check_timeout(){ static $g90272; if(is_null($g90272)) { $ef48ef=ini_get('max_execution_time'); if ($ef48ef){ $g90272=time()+$ef48ef-5; } else { $g90272=0; } } return ($g90272==0)?true:$g90272 >= time(); } function e2_write_dump_header($d8c7dd){ $q099fb=( 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";' .PHP_EOL. 'SET AUTOCOMMIT=0;' .PHP_EOL. 'START TRANSACTION;' .PHP_EOL. "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;" .PHP_EOL. "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;" .PHP_EOL. "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;" .PHP_EOL. "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;" .PHP_EOL. "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;" .PHP_EOL. "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;" .PHP_EOL. "/*!40101 SET NAMES utf8 */;" .PHP_EOL. "/*!50503 SET NAMES utf8mb4 */;" .PHP_EOL. '' ); fwrite($d8c7dd,$q099fb); return true; } function e2_write_dump_footer($d8c7dd){ $s251d1='COMMIT;' .PHP_EOL; $s251d1 .= "/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;" .PHP_EOL ."/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;" .PHP_EOL ."/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;" .PHP_EOL ."/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;".PHP_EOL ."/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;" .PHP_EOL ."/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;" .PHP_EOL; fwrite($d8c7dd,$s251d1); return true; } function e2_get_table_definition($v0c1d0,$oaab9e){ $w5c286=null; $result=mysqli_query($v0c1d0,"SHOW CREATE TABLE `{$oaab9e}`"); if($result){ $u47c80=mysqli_fetch_array($result); $w5c286=$u47c80['Create Table']; } return $w5c286; } function e2_write_table_definition($d8c7dd,$v0c1d0,$oaab9e){ $u30618=e2_get_table_definition($v0c1d0,$oaab9e); if(e2_check_timeout() && $u30618){ fwrite($d8c7dd,$u30618); fwrite($d8c7dd,';'); fwrite($d8c7dd,PHP_EOL.PHP_EOL); return true; } return false; } function e2_get_table_data($v0c1d0,$oaab9e,$v7a86c,$maa9f7){ $b1b1cc="SELECT * FROM `{$oaab9e}` LIMIT {$v7a86c}, {$maa9f7}"; $result=mysqli_query($v0c1d0,$b1b1cc); if (!$result){ return false; } $y66e9c=''; $b3c41a="INSERT INTO `{$oaab9e}` VALUES"; while ($mf1965=mysqli_fetch_assoc($result)) { $n691d5=array(); foreach($mf1965 as $w2063c){ $n691d5[] = is_null($w2063c)?"NULL":"'".mysqli_real_escape_string($v0c1d0,$w2063c)."'"; } $y66e9c.=$b3c41a.'('.join(', ',$n691d5).');'.PHP_EOL; } return $y66e9c; } function e2_table_disable_keys($oaab9e){ return "ALTER TABLE `{$oaab9e}` DISABLE KEYS;".PHP_EOL; } function e2_table_enable_keys($oaab9e){ return "ALTER TABLE `{$oaab9e}` ENABLE KEYS;".PHP_EOL; } function e2_get_total_records($v0c1d0,$oaab9e){ $d8ce4b=mysqli_fetch_row(mysqli_query($v0c1d0,"SELECT COUNT(*) FROM `{$oaab9e}`")); return $d8ce4b[0]; } function e2_write_table_data($d8c7dd,$v0c1d0,$oaab9e){ $ifbb44=e2_get_total_records($v0c1d0,$oaab9e); $v7a86c=0; $maa9f7=1000; $result=true; $h47495=20000; $x80fc1=30; if ($ifbb44){ $efbda5=e2_table_disable_keys($oaab9e); fwrite($d8c7dd,$efbda5); } $y66e9c="INSERT INTO `{$oaab9e}` VALUES"; $wde57a=$ifbb44; while ($wde57a > 0){ $b1b1cc="SELECT * FROM `{$oaab9e}` LIMIT {$v7a86c}, {$maa9f7}"; $result=mysqli_query($v0c1d0,$b1b1cc); $wb428d=mysqli_num_rows($result); if (!$result || !e2_check_timeout()) { $result=false; break; } $cdf347=array(); $d4b3a6=0; $gb6539=0; while ($mf1965=mysqli_fetch_assoc($result)) { if (!e2_check_timeout()) { $result=false; break; } $wb428d--; $i54ca8=array(); foreach($mf1965 as $w2063c){ $i54ca8[] = is_null($w2063c)?"NULL":"'".mysqli_real_escape_string($v0c1d0,$w2063c)."'"; } $s8d777='('.join(', ',$i54ca8).')'; $d4b3a6+=strlen($s8d777); $cdf347[] = $s8d777; $gb6539++; if ( ($d4b3a6 >= $h47495) || ($gb6539 >= $x80fc1) || ($wb428d==0)) { $b1b1cc=$y66e9c.join(', ',$cdf347).';'; fwrite($d8c7dd,$b1b1cc); fwrite($d8c7dd,PHP_EOL); $d4b3a6=0; $gb6539=0; $cdf347=array(); } } $v7a86c+=$maa9f7; $wde57a -= $maa9f7; } if ($ifbb44){ $t6bfc4=e2_table_enable_keys($oaab9e); fwrite($d8c7dd,$t6bfc4); } return$result; } function e2_backup($v0c1d0,$u9ab2e,$va9745,$n93da6=array()) { $c2beda=tmpfile(); e2_write_dump_header($c2beda); if(Log::$ned2b5)__log('Backup: wrote header'); $e75101=true; foreach($u9ab2e as $oaab9e){ if(Log::$ned2b5)__log('Backup: table '. $oaab9e); $s91e7e=e2_write_table_definition($c2beda,$v0c1d0,$oaab9e); if(Log::$ned2b5)__log('Backup: wrote table definition with result '. (int)$s91e7e); $d35285=e2_write_table_data($c2beda,$v0c1d0,$oaab9e); if(Log::$ned2b5)__log('Backup: wrote table data with result '. (int)$d35285); $e75101=$s91e7e && $d35285; if ($e75101===false){ break; } } if(Log::$ned2b5)__log('Backup: wrote data with running == '. (int)$e75101); if ($e75101){ e2_write_dump_footer($c2beda); fseek($c2beda,0); $d8c7dd=fopen($va9745,'w+'); while ($e75101 && ($s8d777=fread($c2beda,1024))) { if(e2_check_timeout()) { fwrite($d8c7dd,$s8d777); } else { $e75101=false; } } fclose($d8c7dd); } fclose($c2beda); return $e75101; } function n3e5c($e0c426,$content){ $y52766=MTMPL_FOLDER.$e0c426 .'.mtmpl.php'; if(is_file($y52766)) { ob_start(); include $y52766; $ade7a3=ob_get_contents(); ob_end_clean(); return trim($ade7a3); } } function daed2(){ global$_config,$_superconfig; $j9e35a=$_config['mail_from']; if (@$_superconfig['mail_from']) { $j9e35a=$_superconfig['mail_from']; } if ($j9e35a[strlen($j9e35a)-1]=='@'){ $j9e35a.=$_SERVER['HTTP_HOST']; } return $j9e35a; } function fa41b($j01b6e,$subject,$m78e73,$p145a2=''){ global$_superconfig; if (@$_superconfig['mail_debug']) { $y85114='mail-debug'; $x8fa14=basename(tempnam($y85114,'m-')); $a1cb25=( 'To:       '.$j01b6e ."\n". 'Subject:  '.$subject ."\n". $p145a2 ."\n". "--------------------------------------------------\n". $m78e73 ); k6e52($y85114 .'/'. $x8fa14,$a1cb25); chmod($y85114 .'/'. $x8fa14,E2_NEW_FILES_RIGHTS); rename($y85114 .'/'. $x8fa14,$y85114 .'/'. $x8fa14.'.txt'); } $subject='=?UTF-8?B?'. base64_encode($subject) .'?='; $p145a2.="\r\nContent-Type: text/plain; charset=utf-8"; mail($j01b6e,$subject,$m78e73,trim($p145a2)); } function _A($a1cb25){ global$_candy,$_protocol,$x57de2,$ra57c1,$_current_url; if ( preg_match('/\<a href\=\"(.*?)\"[^>]*\>(.*?)\<\/a\>/si',$a1cb25,$j9c28d) and ( $j9c28d[1]==='' or $j9c28d[1]===$_current_url or $_protocol .'://'. $x57de2.$j9c28d[1]===$_current_url or $_protocol .'://'. $x57de2.$ra57c1 .'/'. $j9c28d[1]===$_current_url or $_candy=='e2m_install' ) ) { return $j9c28d[2]; } else { return $a1cb25; } } function _AT($xe8fab){ global$_candy,$x57de2,$ra57c1,$_current_url; return ( $xe8fab==='' or $xe8fab===$_current_url or $_protocol .'://'. $x57de2.$xe8fab===$_current_url or $_protocol .'://'. $x57de2.$ra57c1 .'/'. $xe8fab===$_current_url ); } function _IMGSRC($j435ed){ return b1492($j435ed); } function _SVG($j435ed){ return kf42c($j435ed); } function _COLOR($bf97c5,$ob8a9f,$icc321,$y4efa2=1){ if(strlen($bf97c5)!=3 and strlen($bf97c5)!=6) return 'f0f'; if(strlen($ob8a9f)!=3 and strlen($ob8a9f)!=6) return 'f0f'; if(strlen($bf97c5)==3)$bf97c5=$bf97c5[0].$bf97c5[0].$bf97c5[1].$bf97c5[1].$bf97c5[2].$bf97c5[2]; if(strlen($ob8a9f)==3)$ob8a9f=$ob8a9f[0].$ob8a9f[0].$ob8a9f[1].$ob8a9f[1].$ob8a9f[2].$ob8a9f[2]; $zf09cc=array ( $bf97c5[0].$bf97c5[1],$bf97c5[2].$bf97c5[3],$bf97c5[4].$bf97c5[5], $ob8a9f[0].$ob8a9f[1],$ob8a9f[2].$ob8a9f[3],$ob8a9f[4].$ob8a9f[5], ); foreach ($zf09cc as $d8ce4b => $t9e366){ $zf09cc[$d8ce4b]=hexdec($t9e366); } $q22af6=array ( $zf09cc[0]+pow($icc321,$y4efa2) * ($zf09cc[3]-$zf09cc[0]), $zf09cc[1]+pow($icc321,$y4efa2) * ($zf09cc[4]-$zf09cc[1]), $zf09cc[2]+pow($icc321,$y4efa2) * ($zf09cc[5]-$zf09cc[2]), ); $n70dda=''; foreach ($q22af6 as $d8ce4b => $t9e366){ $n70dda.=str_pad(dechex($t9e366),2,'0',STR_PAD_LEFT); } return $n70dda; } function _DT($n1ddcb,$cb35c6){ if (!$cb35c6) return ''; list ($k96b8c,$mb2c6c)=$cb35c6; $r2cb9d=$n1ddcb; $n7436f=h5a2f('m',$k96b8c,$mb2c6c); $r2cb9d=str_replace('{zone}',e2__escape_all(f9515($mb2c6c['offset'])), $r2cb9d); $r2cb9d=str_replace('{month}',e2__escape_all(e2l_get_string('um--month', array ('month' => $n7436f))), $r2cb9d); $r2cb9d=str_replace('{month-short}',e2__escape_all(e2l_get_string('um--month-short', array ('month' => $n7436f))), $r2cb9d); $r2cb9d=str_replace('{month-g}',e2__escape_all(e2l_get_string('um--month-g', array ('month' => $n7436f))), $r2cb9d); $r2cb9d=h5a2f($r2cb9d,$k96b8c,$mb2c6c); return $r2cb9d; } function _AGO($cb35c6){ return y9093($cb35c6[0], array ('offset' => $cb35c6[1]['offset'],'is_dst' => $cb35c6[1]['is_dst']) ); } function _NUM($a1cb25){ return e2_decline_for_number($a1cb25); } function _FIRST($p437b9){ return ($p437b9['_']['_ord']==0); } function _LAST($p437b9){ return ($p437b9['_']['_ord']==$p437b9['_']['_ord_max']); } function _CSS($ic7a62){ return hd4c1($ic7a62); } function _CSS_HREF($ic7a62){ return h576f($ic7a62); } function _JS($r32981){ return xd00a($r32981); } function _LIB($be8acc){ return v16f0($be8acc); } function _T($b52678){ return q166b($b52678); } function _T_DEFER($vb0689){ return tab71($vb0689); } function _X($b52678){ return a6a97($b52678); } function _T_FOR($b52678,$yd5566=null){ global$content; if ($yd5566===null)$yd5566=$b52678; if(array_key_exists($yd5566,$content)) { q166b($b52678); } } function _GUIDES($eeca07=false){ global$_olba_guides; if(is_array($eeca07))$_olba_guides=$eeca07; if (!is_array($_olba_guides)) return; $y88408='<div style="position: fixed; width: 100%; height: 100%; z-index: -100">'; $r1d623=0; $x07d43=$_olba_guides; $x07d43[] = 100; foreach ($x07d43 as $f865c0 => $id89e2){ if ($id89e2==100) break; $r1d623+=$id89e2; $y88408.='<div style="position: fixed; left: '. $id89e2 .'%; width: 0; height: 100%; border-left: 1px #000 dotted; opacity: .2; -webkit-opacity: .2; -moz-opacity: .2"></div>'; $za1b01='position: absolute; padding: 2px 3px; top: 0; font-size: 9px; background: #ccc; color: #000; font-family: "Verdana", sans-serif; opacity: .8; -webkit-opacity: .8; -moz-opacity: .8'; if ($x07d43[$f865c0+1]-$x07d43[$f865c0] < 4){ $y88408.='<div style="'. $za1b01.'; right: '. (100-$id89e2) .'%; border-bottom-left-radius: .5em; -webkit-border-bottom-left-radius: .5em; -moz-border-bottom-left-radius: .5em;">'. $id89e2 .'%</div>'; } else { $y88408.='<div style="'. $za1b01.'; left: '. $id89e2 .'%; border-bottom-right-radius: .5em; -webkit-border-bottom-right-radius: .5em; -moz-border-bottom-right-radius: .5em;">'. $id89e2 .'%</div>'; } } $y88408.='</div>'; $_olba_current_col=0; return $y88408; } function _S($fb45cf){ global$_strings; return$_strings[$fb45cf]; } function _SHORTCUT($vb0689){ return xbb8d($vb0689); } function e2__escape_all($fb45cf){ $r2cb9d=''; for ($f865c0=0; $f865c0 < mb_strlen($fb45cf); ++ $f865c0){ $r2cb9d.='\\'. mb_substr($fb45cf,$f865c0,1); } return $r2cb9d; } abstract class E2GIP { protected $gip_cookie_name='gip'; protected $gip_token_cookie_name='gip_access_token'; protected $gip_token=null; abstract public function get_auth_url(); abstract public static function get_profile_url($xb80bb,$q2a304); abstract public function callback(); const PHP_VERSION_VK_FEATURE=70100; public static function set_session_data($b3c6e0,$w2063c){ if(session_status()==PHP_SESSION_NONE){ session_start(); } $_SESSION[$b3c6e0]=$w2063c; } public static function get_session_data($b3c6e0,$ne2181=false){ if(session_status()==PHP_SESSION_NONE){ session_start(); } if(!isset($_SESSION[$b3c6e0])) { return null; } $w2063c=$_SESSION[$b3c6e0]; if($ne2181){ unset($_SESSION[$b3c6e0]); } return $w2063c; } public static function get_gips_order(){ return [ 'twitter' => 0, 'facebook' => 1, 'vk' => 2 ]; } public function get_config($b3c6e0){ $icbb14='gips/'. $this->type .'.json'; if(is_file(USER_FOLDER.$icbb14)) { $z466de=@file_get_contents(USER_FOLDER.$icbb14); } else { $z466de=@file_get_contents(SYSTEM_FOLDER.$icbb14); } if ($z466de!==false){ $r2cb9d=json_decode($z466de,true,512,JSON_BIGINT_AS_STRING)[$b3c6e0]; if ($r2cb9d) return $r2cb9d; } return null; } public function get_callback_url(){ return x83c8('e2m_gip_sign_in_callback', array('provider' => $this->type)); } protected function get_proxy_param(){ global$settings; $m75725=DEFAULT_LANGUAGE; if(array_key_exists('language',$settings))$m75725=$settings['language']; return '?language='.$m75725.'&type='.$this->type.'&callback_url='.urlencode($this->get_callback_url()); } public function get_gip_session_data(){ global$_config; $b94a08=$this->gip_token?$this->gip_token:$_COOKIE[v8c3b($this->gip_token_cookie_name)]; u0738( "SELECT * FROM `". $_config['db_table_prefix']."GIPsSessions` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `GIP` = '". $this->type ."' ". "AND `SessionToken` = '".a7928($b94a08)."' ". "ORDER BY `ID` DESC LIMIT 1", 'get GIP session data' ); $result=d0d6b(); return$result?$result[0] : array(); } public function is_logged_in(){ if(empty($_COOKIE[v8c3b($this->gip_cookie_name)]) || !in_array($_COOKIE[v8c3b($this->gip_cookie_name)], e2_list_gips()) || $_COOKIE[v8c3b($this->gip_cookie_name)] != $this->type || empty($_COOKIE[v8c3b($this->gip_token_cookie_name)])) { return false; } $s8d777=$this->get_gip_session_data(); return (bool)$s8d777; } protected function save_session($xb80bb,$vb0689,$accessToken,$tb974d='',$userEmail='',$userLink=''){ $k96b8c=time(); v9943( 'GIPsSessions', array ( 'GIP' => $this->type, 'GIPAuthorID' => $xb80bb, 'AuthorName' => $vb0689, 'AuthorEmail' => $userEmail, 'AuthorProfileLink' => $userLink, 'SessionToken' => $accessToken, 'Stamp' => $k96b8c, ), 'INSERT', 'ON DUPLICATE KEY UPDATE '. '`SessionToken` = "'.a7928($accessToken).'", '. '`AuthorName` = "'.a7928($vb0689).'", '. '`Stamp` = "'.$k96b8c.'"' ); ic64a($this->gip_cookie_name,$this->type); ic64a($this->gip_token_cookie_name,$accessToken); if(isset($userEmail) && !empty($userEmail))ic64a('commenter_email',$userEmail); $this->gip_token=$accessToken; } public static function get_logout_key(){ if ($f4a73c=self::get_session_data('logout_key')) { return $f4a73c; } $f4a73c=md5(microtime()); self::set_session_data('logout_key',$f4a73c); return $f4a73c; } public static function is_valid_logout_key($b3c6e0){ $yeb1de=self::get_session_data('logout_key',true); if (empty($yeb1de) || empty($b3c6e0) || $yeb1de!=$b3c6e0){ return false; } return true; } public function logout(){ global$_config; ic64a($this->gip_cookie_name); ic64a($this->gip_token_cookie_name); u0738( "DELETE FROM `". $_config['db_table_prefix']."GIPsSessions` ". "WHERE `SubsetID`=". $_config['db_table_subset'] ." ". "AND `GIP` = '".$this->type."' ". "AND `SessionToken` = '" . a7928($_COOKIE[v8c3b($this->gip_token_cookie_name)]) . "'", 'logout' ); } public function get_avatar_width(){ return USERPIC_WIDTH; } public function get_avatar_height(){ return USERPIC_HEIGHT; } public function save_avatar($xb80bb,$p3d02b){ global$_config; @eaf42(MEDIA_ROOT_FOLDER.AVATARS_FOLDER); @chmod(MEDIA_ROOT_FOLDER.AVATARS_FOLDER,$_config['uploaded_files_mode']); $j435ed=MEDIA_ROOT_FOLDER.AVATARS_FOLDER.$this->type .'-'. $xb80bb .'.jpg'; if ($n5b860=file_get_contents($p3d02b)) { file_put_contents($j435ed,$n5b860); } return $j435ed; } } function e2m_gip_sign_in($s8d777){ global$_config,$settings; $type=$s8d777['provider']; $c7123a=e2_get_gip_instance($type); if (!$c7123a){ j4930(); die; } header('Location: '.$c7123a->get_auth_url()); die; } function e2m_gip_sign_in_callback($s8d777){ global$_config; $type=$s8d777['provider']; $c7123a=e2_get_gip_instance($type); if (!$c7123a){ die($type.' is not defined'); } $g73797=$c7123a->callback(); echo '<script>'; if ($g73797===true){ $ja64f4=$c7123a->get_gip_session_data(); $x78506=[ 'name' => $ja64f4['AuthorName'], 'gipIcon' => _SVG($type), 'logoutUrl' => x83c8('e2m_gip_sign_out', array('provider' => E2GIP::get_logout_key())), ]; echo 'window.opener.oauthAuthorized('.json_encode($x78506).');'; } else { echo 'alert (\''. $g73797. '\');'; } echo 'window.close();</script>'; die; } function e2m_gip_sign_out($s8d777){ global$_config; $f4a73c=$s8d777['provider']; if (!E2GIP::is_valid_logout_key($f4a73c)) { die('invalid logout key'); } $c7123a=e2_get_logged_gip(); if($c7123a){ $c7123a->logout(); } j4930(); die; } function e2_list_gips(){ static $y2d168=null; if(!is_null($y2d168)) { return $y2d168; } $q1c05f=SYSTEM_FOLDER. 'gips/'; $r700f6=opendir($q1c05f); $y2d168=[]; $f965d3=E2GIP::get_gips_order(); $cf5f73=count($f965d3); while (($d8c7dd=readdir($r700f6)) !== false){ if(pathinfo($d8c7dd,PATHINFO_EXTENSION)!='php') continue; $c77dca=pathinfo($d8c7dd,PATHINFO_FILENAME); if ($c77dca=='vk'){ if(PHP_VERSION_ID < E2GIP::PHP_VERSION_VK_FEATURE) continue; } $b3c6e0=isset($f965d3[$c77dca]) ? $f965d3[$c77dca] : ++$cf5f73; $y2d168[$b3c6e0]=$c77dca; } closedir($r700f6); ksort($y2d168); return $y2d168; } function e2_get_gip_class_name($type){ return "E2GIP".ucfirst($type); } function e2_get_gip_instance($type){ if (!in_array($type,e2_list_gips())) { return false; } $u38c9b=e2_get_gip_class_name($type); $c7123a=new $u38c9b; return $c7123a; } function e2_get_gip_auth_url($type){ return x83c8('e2m_gip_sign_in', array('provider' => $type)); } function e2_is_logged_in($type=''){ $qd14a8=!$type?e2_list_gips() : array($type); foreach($qd14a8 as$type){ $c7123a=e2_get_gip_instance($type); if ($c7123a && $c7123a->is_logged_in()) { return true; } } return false; } function e2_get_logged_gip(){ foreach(e2_list_gips() as$type){ $c7123a=e2_get_gip_instance($type); if ($c7123a && $c7123a->is_logged_in()) { return $c7123a; } } return false; } function e2_get_logged_gip_name(){ foreach(e2_list_gips() as$type){ $c7123a=e2_get_gip_instance($type); if ($c7123a && $c7123a->is_logged_in()) { return$type; } } return false; } function e2_get_user_profile_url($type,$xb80bb,$q2a304){ $u38c9b=e2_get_gip_class_name($type); return $u38c9b::get_profile_url($xb80bb,$q2a304); } function e2_get_gip_session($type){ $c7123a=e2_get_gip_instance($type); if (!$c7123a || !$c7123a->is_logged_in()) { return false; } return $c7123a->get_gip_session_data(); } foreach(e2_list_gips() as $z48e15){ require_once 'system/gips/'.$z48e15.'.php'; } define('__DEV', (@$_config['dev_verbose'] > (int) !we852())); $_stopwatch=v7f78($_stopwatch); spl_autoload_register('n713e'); r372b(); r74e0(); $_strings=hfc91(); if(!BUILT) @include 'builder.php'; function e2(){ global$settings,$content, $_candy, $_lang, $_config, $_strings, $_candies_installer, $_candies_public, $_candies_ajax, $_candies_to_disallow_in_read_only, $_template, $_diagnose; oabdd(); set_error_handler('we1c4'); set_exception_handler('maefe'); header('X-Powered-By: E2 Aegea v'. E2_VERSION); header('Content-type: text/html; charset=UTF-8'); list ($uc48ba,$parameters)=sb7e9(); try { $content=[]; $_candy=$uc48ba; if ( @$_config['dev_slow_ajax'] and ( in_array($uc48ba,$_candies_ajax) ) ) { sleep(1+2 * (rand()/getrandmax())); } if (!in_array($uc48ba,$_candies_installer)) { hd660(); } if (@$_config['read_only'] and in_array($uc48ba,$_candies_to_disallow_in_read_only)) { $uc48ba='e2m_error404'; } $p58387=(bool)we852(); $s0b448=!in_array($uc48ba,$_candies_public); if(Log::$ned2b5)__log('User signed in? '. ($p58387? 'Yes':'No')); $_newsfeeds=[]; q3010('rss',n6f51(),x83c8('e2m_rss')); q3010('json',n6f51(),x83c8('e2m_json')); if(substr($uc48ba,0,4)=='e2m_'){ udb82(); } if(is_callable($uc48ba)) { if ($s0b448 && !$p58387){ if(substr($uc48ba,0,4)=='e2s_'){ $content=call_user_func('e2s_sign_in_necessary'); } else { $content['title']=$_strings['pt--sign-in']; } } else { if(Log::$ned2b5)__log('Candy call {'); $content=call_user_func($uc48ba,$parameters); if(Log::$ned2b5)__log('}'); } } else { $s0b448=false; $content=e2_error404_mode(); } } catch (AeMySQLException $e){ if(substr($uc48ba,0,4)=='e2s_'){ q4aff($e); } else { b12f6($e); $parameters=array(); $content['unavailable?']=true; } } if (!is_array($content))$content=array(); if (!array_key_exists('class',$content)) { $content['class']=str_replace('_','-',str_replace('e2m_','',$uc48ba)); } if (!array_key_exists('notes',$content))$content['notes'] = array (); if (!array_key_exists('drafts',$content))$content['drafts'] = array (); if (!array_key_exists('comments',$content))$content['comments'] = array (); if (!array_key_exists('notes-list',$content))$content['notes-list'] = array (); if (n2ac5()!==null){ if(Log::$ned2b5)__log('Stuff for installed engine {'); $content['sign-in'] = [ 'done?' => $p58387, 'required?' => $s0b448, 'necessary?' => $s0b448 && !$p58387, 'href' => x83c8('e2m_sign_in'), 'prompt' => $_strings['gs--need-password'], ]; $content['hrefs'] = array ( 'everything' => x83c8('e2m_everything'), ); if (!array_key_exists('popular',$content)) $content['popular']=o7f52(); if (!array_key_exists('tags',$content)) $content['tags']=ie531($parameters); $content['blog']=t3020(); $content['form-search']=a5070($parameters); $content['form-login']=c126f(); $content['engine']=h29a1(); $content['template']['respond-to-dark-mode?'] = ( $_template['supports_dark_mode'] and (bool) @$settings['appearance']['respond_to_dark_mode'] ); $content['template']['use-likely-light?']=$_template['use_likely_light']; if (!array_key_exists('summary',$content)) { $content['summary']=strip_tags($content['blog']['description']); } if (we852()) { $content['admin']=o5e47(); $content['last-modifieds-by-id']='{}'; if (@$_COOKIE[v8c3b('local_copies')]) { $content['last-modifieds-by-id'] = ( ua2d8($_COOKIE[v8c3b('local_copies')]) ); } } if(Log::$ned2b5)__log('}'); } $content['title']=strip_tags(u6f10(htmlspecialchars($content['title'],ENT_NOQUOTES,HSC_ENC))); if (@$content['heading']) { $content['heading']=strip_tags(u6f10(htmlspecialchars($content['heading'],ENT_NOQUOTES,HSC_ENC))); } $content['language']=$_lang; if (!@isset ($_diagnose['ok?'])) { if (@$_COOKIE[v8c3b('diagnose')] or @$_diagnose['need?']) { k8739(); } } if ( $settings['appearance']['show_view_counts'] and is_array($content['notes']) and count($content['notes']) > 0 ){ $content['notes']=e2_populate_read_counts_in_notes_ctree_($content['notes']); } foreach($content['notes'] as $saad65){ a57ad($saad65['format-info']['links-required']); } $content['message']=u0955(); $e78e62=gbc21(); $content['meta']=rc4da( $uc48ba, $content['notes'], $content['tag'], $content['blog'], $content['pages'] ); $content['stat']=l6442(); $e78e62=y326f($e78e62); $lfa6a9=false; if (n2ac5()!==null and u3b97()) { if(is_writable(USER_FOLDER.'indexing.psa')) { $lfa6a9=true; } else { $_diagnose['need?']=true; ic64a('diagnose','1'); } } echo $e78e62; if (n2ac5()!==null and $lfa6a9){ if(Log::$ned2b5)__log('Spawn BSI step'); gcc38(x83c8('e2s_bsi_step', array ())); } if (@$_config['dev_dump_ctree'])sce80($content); } ?>

Function Calls

None

Variables

None

Stats

MD5 e4660e92f2f5d5ba912fc70ad23eba29
Eval Count 0
Decode Time 351 ms