-
-
-
-
-
-
-
-
-
-
-
-
-
";
-
- if(!empty($this->notify_prefs['plugins']))
- {
-
- foreach ($this->notify_prefs['plugins'] as $plugin_id => $plugin_settings)
- {
- if(is_readable(e_PLUGIN.$plugin_id.'/e_notify.php'))
- {
- $config_category = $this->pluginConfig[$plugin_id]['category'];
- $legacy = $this->pluginConfig[$plugin_id]['legacy'];
-
- // require(e_PLUGIN.$plugin_id.'/e_notify.php');
-
- $text .= "
-
";
- }
- }
- }
-
- $text .= "
-
-
";
- $text .= $frm->admin_button('update', LAN_UPDATE,'update');
- $text .= "
-
-
-
- ";
-
- $ns -> tablerender(NT_LAN_1, $mes->render() . $text);
- */
-
- }
-
-
- function render_event($id, $description, $include='', $legacy = 0)
- {
- $tp = e107::getParser();
- $frm = e107::getForm();
- $uc = e107::getUserClass();
- $uc->fixed_classes['email'] = NM_LAN_3;
- $uc->text_class_link['email'] = 'email';
-
-
- if(defined($description))
- {
- $description = constant($description);
- }
-
-
-
- $highlight = varset($_GET['type']) == $id ? " class='text-warning'" : '';
-
- $text = "
-
- ".$description.": | ";
-
-
-
- if(e_DEBUG)
- {
- $text .= "".$id." | ";
- }
-
- $text .= "
-
- ".$uc->uc_dropdown('event['.$id.'][class]', varset($this->notify_prefs['event'][$id]['class'], e_UC_NOBODY), "nobody,main,admin,member,classes,email","onchange=\"mail_field(this.value,'event_".$id."');\" ");
-
- if($this -> notify_prefs['event'][$id]['class'] == 'email')
- {
- $disp='display:visible';
- $value = $tp -> toForm($this -> notify_prefs['event'][$id]['email']);
- }
- else
- {
- $disp = "display:none";
- $value= "";
- }
-
- $text .= "\n";
-
- $text .= $frm->hidden("event[".$id."][include]", $include);
- $text .= $frm->hidden("event[".$id."][legacy]", $legacy); // function or method
-
- if(isset($this->notify_prefs['event'][$id]['class']) && $this->notify_prefs['event'][$id]['class'] != e_UC_NOBODY)
- {
- $text .= $frm->button('test['.$id.']', $id, 'confirm', LAN_TEST);
- }
-
-
- $text .= " | ";
-
-
-
-
- $text .= "
-
";
- return $text;
- }
-
-
- function update()
- {
- $this->changeList = array();
-
- $active = false;
-
- foreach ($_POST['event'] as $key => $value)
- {
- if ($this -> update_event($key))
- {
- $active = true;
- }
- }
-
- // print_a($this->notify_prefs);
- /*
- $s_prefs = $tp -> toDB($this -> notify_prefs);
- $s_prefs = $eArrayStorage -> WriteArray($s_prefs);
- if($sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'")!==FALSE)
- */
-
- e107::getConfig()->set('notify',$active)->save(true,true,false);
- e107::getConfig('notify')->updatePref($this->notify_prefs);
- if (e107::getConfig('notify')->save(FALSE))
- {
- // e107::getAdminLog()->logArrayAll('NOTIFY_01',$this->changeList);
- return true;
- }
- else
- {
- return false;
- }
-
- }
-
- function update_event($id)
- {
- $changed = FALSE;
-
- if ($this -> notify_prefs['event'][$id]['class'] != $_POST['event'][$id]['class'])
- {
- $this -> notify_prefs['event'][$id]['class'] = $_POST['event'][$id]['class'];
- $changed = TRUE;
- }
- if ($this -> notify_prefs['event'][$id]['email'] != $_POST['event'][$id]['email'])
- {
- $this -> notify_prefs['event'][$id]['email'] = $_POST['event'][$id]['email'];
- $changed = TRUE;
- }
-
- $this -> notify_prefs['event'][$id]['include'] = $_POST['event'][$id]['include'];
- $this -> notify_prefs['event'][$id]['legacy'] = $_POST['event'][$id]['legacy'];
-
- unset($this -> notify_prefs['event'][$id]['plugin']);
- unset($this -> notify_prefs['event'][$id]['type']);
-
- if ($changed)
- {
- $this->changeList[$id] = $this->notify_prefs['event'][$id]['class'].', '.$this->notify_prefs['event'][$id]['email'];
- }
- if ($this -> notify_prefs['event'][$id]['class'] != 255)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ return $js;
}
}
-
-require_once(e_ADMIN.'footer.php');/*
-function headerjs()
-{
-
- $js = "
- ";
-
- return $js;
-}*/
-?>
diff --git a/e107_admin/phpinfo.php b/e107_admin/phpinfo.php
index 4edc471d7..956fdcdeb 100644
--- a/e107_admin/phpinfo.php
+++ b/e107_admin/phpinfo.php
@@ -8,7 +8,7 @@
*
*/
-require_once("../class2.php");
+require_once(__DIR__.'/../class2.php');
if(!getperms("0"))
{
diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php
index a5d4705e0..dda494667 100755
--- a/e107_admin/plugin.php
+++ b/e107_admin/plugin.php
@@ -10,7 +10,7 @@
*
*/
-require_once("../class2.php");
+require_once(__DIR__.'/../class2.php');
if(!getperms("Z"))
{
@@ -2085,6 +2085,10 @@ class pluginLanguage extends e_admin_ui
}
+new plugman_adminArea();
+require_once(e_ADMIN."auth.php");
+e107::getAdminUI()->runPage();
+require_once(e_ADMIN."footer.php");
@@ -2098,26 +2102,6 @@ class pluginLanguage extends e_admin_ui
-//if(deftrue('e_DEBUG_PLUGMANAGER'))
-{
- new plugman_adminArea();
- require_once(e_ADMIN."auth.php");
- e107::getAdminUI()->runPage();
- require_once(e_ADMIN."footer.php");
- exit;
-
-}
-
-
-
-
-
-
-
-
-
-
-
@@ -2243,1288 +2227,8 @@ $mes = e107::getMessage();
$frm = e107::getForm();*/
require_once("footer.php");
-exit;
-// FIXME switch to admin UI
-/*
-class pluginManager{
-
- var $plugArray;
- var $action;
- var $id;
- var $frm;
- var $fieldpref;
- var $titlearray = array();
- var $pagetitle;
-
-
- var $mp;
-
- protected $pid = 'plugin_id';
-
- protected $fields = array(
-
- "checkboxes" => array("title" => "", 'type'=>null, "forced"=>TRUE, "width"=>"3%", 'thclass'=>'center','class'=>'center'),
- "plugin_icon" => array("title" => EPL_ADLAN_82, "type"=>"icon", "width" => "5%", "thclass" => "middle center",'class'=>'center', "url" => ""),
- "plugin_name" => array("title" => EPL_ADLAN_10, 'forced'=>true, "type"=>"text", "width" => "auto", 'class'=>'left', "thclass" => "middle", "url" => ""),
- "plugin_version" => array("title" => EPL_ADLAN_11, "type"=>"numeric", "width" => "5%", "thclass" => "middle", "url" => ""),
- "plugin_date" => array("title" => LAN_RELEASED, "type"=>"text", "width" => "8%", "thclass" => "middle"),
-
- "plugin_folder" => array("title" => EPL_ADLAN_64, "type"=>"text", "width" => "10%", "thclass" => "middle"),
- "plugin_category" => array("title" => LAN_CATEGORY, "type"=>"text", "width" => "auto", "thclass" => "middle"),
- "plugin_author" => array("title" => LAN_AUTHOR, "type"=>"text", "width" => "10%", "thclass" => "middle"),
- "plugin_license" => array("title" => "License", 'nolist'=>true, "forced"=>true, "type"=>"text", "width" => "5%", "thclass" => "left"),
- // "plugin_price" => array("title" => "Price", 'nolist'=>true, "forced"=>true, "type"=>"text", "width" => "5%", "thclass" => "left"),
- "plugin_compatible" => array("title" => EPL_ADLAN_13, "type"=>"text", "width" => "5%", "thclass" => "middle"),
- "plugin_description" => array("title" => EPL_ADLAN_14, "type"=>"bbarea", "width" => "30%", "thclass" => "middle center", 'readParms' => 'expand=1&truncate=180&bb=1'),
- "plugin_compliant" => array("title" => EPL_ADLAN_81, "type"=>"text", "width" => "5%", "thclass" => "middle center", "url" => ""),
- // "plugin_release" => array("title" => EPL_ADLAN_81, "type"=>"text", "width" => "5%", "thclass" => "middle center", "url" => ""),
- // "plugin_notes" => array("title" => EPL_ADLAN_83, "type"=>"url", "width" => "5%", "thclass" => "middle center", "url" => ""),
-
- "options" => array("title" => LAN_OPTIONS, 'forced'=>TRUE, 'type'=> 'method', "width" => "15%", "thclass" => "right last", 'class'=>'right'),
-
- );
-
-
-
- function __construct()
- {
- global $user_pref,$admin_log;
-
- $qry = str_replace('XDEBUG_PROFILE', '', e_QUERY);
-
- $tmp = explode('.',$qry);
-
- $this -> action = ($tmp[0]) ? $tmp[0] : "installed";
- $this -> id = !empty($tmp[1]) ? intval($tmp[1]) : "";
- $this -> titlearray = array('installed'=>EPL_ADLAN_22,'avail'=>EPL_ADLAN_23, 'upload'=>EPL_ADLAN_38);
-
- if(isset($_GET['mode']))
- {
- $this->action = $_GET['mode'];
- }
-
- if($this->action == 'online')
- {
- // $this->fields["plugin_price"]['nolist'] = false; // = array("title" => "Price", "forced"=>true, "type"=>"text", "width" => "5%", "thclass" => "middle center");
- $this->fields["plugin_license"]['nolist'] = false;
- }
-
- $keys = array_keys($this -> titlearray);
- $this->pagetitle = (in_array($this->action,$keys)) ? $this -> titlearray[$this->action] : $this -> titlearray['installed'];
-
-
-
- }
-
-
- public function getMarketplace()
- {
- if(null === $this->mp)
- {
- require_once(e_HANDLER.'e_marketplace.php');
- $this->mp = new e_marketplace(); // autodetect the best method
- }
- return $this->mp;
- }
-
-
-
- function pluginObserver()
- {
- $tp = e107::getParser();
-
- global $user_pref,$admin_log;
-
- if (isset($_POST['upload']))
- {
- $this -> pluginProcessUpload();
- $this->action = 'avail';
- }
-
- if(isset($_POST['etrigger_ecolumns']))
- {
- $user_pref['admin_pluginmanager_columns'] = $tp->filter($_POST['e-columns']);
- save_prefs('user');
- }
-
- $user_pref['admin_pluginmanager_columns'] = false;
-
- $this -> fieldpref = (vartrue($user_pref['admin_pluginmanager_columns'])) ? $user_pref['admin_pluginmanager_columns'] : array("plugin_icon","plugin_name","plugin_version","plugin_date","plugin_description","plugin_category","plugin_compatible","plugin_author","plugin_website","plugin_notes");
-
-
- foreach($this->fields as $key=>$val)
- {
- if(vartrue($val['forced']) && substr($key,0,6)=='plugin')
- {
- $this->fieldpref[] = $key;
- }
- }
-
- if($this->action == 'download')
- {
- $this->pluginDownload();
- return;
-
- }
-
-
- if($this->action == 'pull' && !empty($this->id))
- {
- $info = e107::getPlugin()->getinfo($this->id);
-
- if(!empty($info['plugin_path']))
- {
- $return = e107::getFile()->gitPull($info['plugin_path'], 'plugin');
- e107::getMessage()->addSuccess($return);
- $this->action = 'refresh';
- }
- else
- {
- $this->action = 'avail';
- }
-
- }
-
-
-
- if($this->action == 'avail' || $this->action == 'installed') // Plugin Check is done during upgrade_routine.
- {
- $this -> pluginCheck();
- }
-
- if($this->action == "uninstall")
- {
- $this -> pluginUninstall();
- $this -> pluginCheck(true); // forced
- }
-
-
-
- if($this->action == "repair")
- {
- $this -> pluginRepair();
- $this->action = 'refresh';
- }
-
-
-
- if($this->action == "refresh")
- {
- $this -> pluginCheck(true); // forced
- }
-
- if($this->action == "install" || $this->action == "refresh")
- {
- $this -> pluginInstall();
- $this -> action = "installed";
- }
-
- if($this->action == 'create')
- {
- $pc = new pluginBuilder;
- return;
-
- }
-
- if($this->action == 'lans')
- {
- $pc = new pluginLanguage;
- return;
-
- }
-
- if($this->action == "upgrade")
- {
- $this -> pluginUpgrade();
- $this -> action = "installed";
- }
-
-
-
- if($this->action == "upload")
- {
- $this -> pluginUpload();
- }
-
- if($this->action == "online")
- {
- $text = $this -> pluginOnline();
- $mes = e107::getMessage();
- e107::getRender()->tablerender(ADLAN_98.SEP.$caption, $mes->render(). $text);
- return;
- }
-
- // print_a($_POST);
-
- if(isset($_POST['install-selected']))
- {
- foreach($_POST['multiselect'] as $val)
- {
- $this -> id = intval($val);
- $this -> pluginInstall();
- }
- $this -> action = "installed";
- }
-
- if($this->action != 'avail' && varset($this->fields['checkboxes']))
- {
- unset($this->fields['checkboxes']); // = FALSE;
- }
-
- if($this->action !='upload' && $this->action !='uninstall')
- {
- $this -> pluginRenderList();
- }
-
-
-
- }
-
-
- private function compatibilityLabel($val='')
- {
- $badge = (vartrue($val) > 1.9) ? "
".EPL_ADLAN_88."" : '1.x';
- return $badge;
- }
-
-
-
- function pluginOnline()
- {
- global $plugin, $e107SiteUsername, $e107SiteUserpass;
- $tp = e107::getParser();
- $frm = e107::getForm();
-
- $caption = EPL_ADLAN_89;
-
- $e107 = e107::getInstance();
- $xml = e107::getXml();
- $mes = e107::getMessage();
-
- // $mes->addWarning("Some older plugins may produce unpredictable results.");
- // check for cURL
- if(!function_exists('curl_init'))
- {
- $mes->addWarning(EPL_ADLAN_90);
- }
-
- //TODO use admin_ui including filter capabilities by sending search queries back to the xml script.
- $from = isset($_GET['frm']) ? intval($_GET['frm']) : 0;
- $srch = preg_replace('/[^\w]/','', vartrue($_GET['srch']));
-
-
- $mp = $this->getMarketplace();
-
- // auth
- $mp->generateAuthKey($e107SiteUsername, $e107SiteUserpass);
-
- // do the request, retrieve and parse data
- $xdata = $mp->call('getList', array(
- 'type' => 'plugin',
- 'params' => array('limit' => 10, 'search' => $srch, 'from' => $from)
- ));
- $total = $xdata['params']['count'];
-
- // OLD BIT OF CODE ------------------------------->
-
- // OLD BIT OF CODE END ------------------------------->
-
-
-// print_a($xdata);
-
- $c = 1;
- foreach($xdata['data'] as $row)
- {
- //$row = $r['@attributes'];
-
- // print_a($row);
-
- $badge = $this->compatibilityLabel($row['compatibility']);;
- $featured = ($row['featured']== 1) ? "
".EPL_ADLAN_91."" : '';
- $price = (!empty($row['price'])) ? "
".$row['price']." ".$row['currency']."" : "
".EPL_ADLAN_93."";
-
- $data[] = array(
- 'plugin_id' => $row['params']['id'],
- 'plugin_mode' => $row['params']['mode'],
- 'plugin_icon' => vartrue($row['icon'],'e-plugins-32'),
- 'plugin_name' => stripslashes($row['name']),
- 'plugin_featured' => $featured,
- 'plugin_sef' => '',
- 'plugin_folder' => $row['folder'],
- 'plugin_date' => vartrue($row['date']),
- 'plugin_category' => vartrue($row['category'], 'n/a'),
- 'plugin_author' => vartrue($row['author']),
- 'plugin_version' => $row['version'],
- 'plugin_description' => nl2br(vartrue($row['description'])),
- 'plugin_compatible' => $badge,
-
- 'plugin_website' => vartrue($row['authorUrl']),
- 'plugin_url' => $row['urlView'],
- 'plugin_notes' => '',
- 'plugin_price' => $row['price'],
- 'plugin_license' => $price
- );
-
- $c++;
- }
-
- $fieldList = $this->fields;
- unset($fieldList['checkboxes']);
-
- $text = "
-
-
-
- ";
-
- if($total > $this->perPage)
- {
- $parms = $total.",".$this->perPage.",".$from.",".e_SELF.'?mode=online&frm=[FROM]';
-
- if(!empty($srch))
- {
- $parms .= '&srch='.$srch;
- }
-
- $text .= "
".$tp->parseTemplate("{NEXTPREV=$parms}",TRUE)."
";
- }
-
- return $text;
-
- }
-
-
-
- function options($data)
- {
-
- // print_a($data);
-
-
-
- //$url = e_SELF."?src=".base64_encode($d);
- // $url = e_SELF.'?action=download&src='.base64_encode($d);//$url.'&action=download';
- $id = 'plug_'.$data['plugin_id'];
- //
- $modalCaption = (!empty($data['plugin_price'])) ? EPL_ADLAN_92." ".$data['plugin_name']." ".$data['plugin_version'] : EPL_ADLAN_230." ".$data['plugin_name']." ".$data['plugin_version'];
-
- $srcData = array(
- 'plugin_id' => $data['plugin_id'],
- 'plugin_folder' => $data['plugin_folder'],
- 'plugin_price' => $data['plugin_price'],
- 'plugin_mode' => $data['plugin_mode'],
- 'plugin_url' => $data['plugin_url'],
- );
-
-
- $d = http_build_query($srcData,false,'&');
- $url = e_SELF.'?mode=download&src='.base64_encode($d);
- $dicon = '
'.ADMIN_INSTALLPLUGIN_ICON.'';
-
-
-
- // Temporary Pop-up version.
- // $dicon = '
';
-
- // $dicon = "
";
-
- return "
- {$dicon}
-
";
- }
-
-
-
- private function pluginDownload()
- {
- define('e_IFRAME', true);
- $frm = e107::getForm();
- $mes = e107::getMessage();
- $tp = e107::getParser();
-
- // print_a($_GET);
-
- $string = base64_decode($_GET['src']);
- parse_str($string, $data);
-
- if(deftrue('e_DEBUG_MARKETPLACE'))
- {
- echo "
DEBUG MODE ACTIVE (no downloading)";
- echo '$_GET[src]: ';
- print_a($_GET);
-
- echo 'base64 decoded and parsed as $data:';
- print_a($data);
- return false;
- }
-
- $pluginFolder = !empty($data['plugin_folder']) ? $tp->filter($data['plugin_folder']) : '';
- $pluginUrl = !empty($data['plugin_url']) ? $tp->filter($data['plugin_url']) : '';
- $pluginID = !empty($data['plugin_id']) ? $tp->filter($data['plugin_id']) : '';
- $pluginMode = !empty($data['plugin_mode']) ? $tp->filter($data['plugin_mode']) : '';
-
- if(!empty($data['plugin_price']))
- {
- e107::getRedirect()->go($pluginUrl);
- return true;
- }
-
- $mp = $this->getMarketplace();
- // $mp->generateAuthKey($e107SiteUsername, $e107SiteUserpass);
-
-
-
- // Server flush useless. It's ajax ready state 4, we can't flush (sadly) before that (at least not for all browsers)
- $mes->addSuccess(EPL_ADLAN_94);
-
- if($mp->download($pluginID, $pluginMode, 'plugin'))
- {
- $this -> pluginCheck(true); // rescan the plugin directory
- $text = e107::getPlugin()->install($pluginFolder);
-
- $mes->addInfo($text);
- echo $mes->render('default', 'success');
- }
- else
- {
- // Unable to continue
- echo $mes->addError(EPL_ADLAN_95)->render('default', 'error');
- }
-
- echo $mes->render('default', 'debug');
- return;
-
-
-
- $text ="
";
- // print_a($data);
- $text .= $frm->open('upload-url-form','post');
-
- $text .= "
";
- $text .= "";
- $text .= $frm->admin_button('upload_remote_url',1,'create','Install');
- $text .= "
";
- $text .= "
\n\n";
-
- $text .= $frm->close();
- echo $text;
-
- }
-
-
- function pluginUninstall()
- {
-
- if(!isset($_POST['uninstall_confirm']))
- { // $id is already an integer
-
- $this->pluginConfirmUninstall();
- return;
- }
-
- $post = e107::getParser()->filter($_POST);
- $text = e107::getPlugin()->uninstall($this->id, $post);
- $this->show_message($text, E_MESSAGE_SUCCESS);
-
- $this->action = 'installed';
-
- $log = e107::getPlugin()->getLog();
- e107::getDebug()->log($log);
-
- return;
-
- }
-
-
-
-
-
- function pluginProcessUpload()
- {
- if (!$_POST['ac'] == md5(ADMINPWCHANGE))
- {
- exit;
- }
-
- $fl = e107::getFile();
- $data = $fl->getUploaded(e_TEMP);
- $mes = e107::getMessage();
-
- if(empty($data[0]['error']))
- {
- if($fl->unzipArchive($data[0]['name'],'plugin'))
- {
- $mes->addSuccess(EPL_ADLAN_43);
- }
- else
- {
- $mes->addError(EPL_ADLAN_97);
- }
- }
-
- // $data = process_uploaded_files(e_TEMP);
- // print_a($data);
-
- echo $mes->render();
-
- return true;
-
-
- }
-
-
-// -----------------------------------------------------------------------------
-// TODO FIXME - This needs cleaning: e107::getMessage(), limit the globals, etc.
-
- function pluginInstall()
- {
- global $plugin;
- $text = $plugin->install_plugin($this->id);
-
- $log = e107::getAdminLog();
-
-
-
- if ($text === FALSE)
- { // Tidy this up
- $this->show_message(EPL_ADLAN_99, E_MESSAGE_ERROR);
- }
- else
- {
- $plugin->save_addon_prefs('update');
- $info = $plugin->getinfo($this->id);
-
- $name = deftrue($info['plugin_name'],$info['plugin_name']). " v".$info['plugin_version']. "({e_PLUGIN}".$info['plugin_path'].")";
-
- $log->add('PLUGMAN_01', $name, E_LOG_INFORMATIVE, '');
-
- $this->show_message($text, E_MESSAGE_SUCCESS);
- }
-
- }
-
-
-// -----------------------------------------------------------------------------
-
- function pluginUpgrade()
- {
- $pref = e107::getPref();
- $admin_log = e107::getAdminLog();
- $plugin = e107::getPlugin();
-
- $sql = e107::getDb();
- $mes = e107::getMessage();
- $plug = $plugin->getinfo($this->id);
-
- $text = '';
-
- $_path = e_PLUGIN.$plug['plugin_path'].'/';
- if(file_exists($_path.'plugin.xml'))
- {
- $plugin->install_plugin_xml($this->id, 'upgrade');
- }
- else
- {
- $eplug_folder = null;
- $upgrade_alter_tables = null;
- $upgrade_add_prefs = null;
- $upgrade_remove_prefs = null;
- $upgrade_add_array_pref = null;
- $upgrade_remove_array_pref = null;
- $eplug_version = null;
-
-
-
- include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
-
- $text = '';
-
- $func = $eplug_folder.'_upgrade';
- if (function_exists($func))
- {
- $text .= call_user_func($func);
- }
-
- if (is_array($upgrade_alter_tables))
- {
- $result = $plugin->manage_tables('upgrade', $upgrade_alter_tables);
- if (true !== $result)
- {
- //$text .= EPL_ADLAN_9.'