diff --git a/class2.php b/class2.php index 12a111c1f..a0dabcde8 100644 --- a/class2.php +++ b/class2.php @@ -908,7 +908,8 @@ if (!class_exists('e107table', false)) private $themeClass = ''; private $adminThemeClass = ''; public $frontend = null; - + private $uniqueId = null; + function __construct() { @@ -918,13 +919,23 @@ if (!class_exists('e107table', false)) /** - * @param $style + * Set the style mode for use in tablestyle() method/function + * @param string $style */ - function setStyle($style) + public function setStyle($style) { $this->eSetStyle = $style; } + /** + * Set a unique id for use in tablestyle() method/function + * @param string $id + */ + public function setUniqueId($id) + { + $this->uniqueId = $id; + } + /** * @param $caption string caption text @@ -948,6 +959,10 @@ if (!class_exists('e107table', false)) extract($result); } + + + + if ($return) { if(!empty($text) && $this->eMenuArea) @@ -998,13 +1013,14 @@ if (!class_exists('e107table', false)) if(is_object(vartrue($thm))) { - $thm->tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea, 'menuCount'=>$this->eMenuCount, 'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]), 'setStyle'=>$this->eSetStyle)); + $thm->tablestyle($caption, $text, $mode, array('uniqueId'=>$this->uniqueId, 'menuArea'=>$this->eMenuArea, 'menuCount'=>$this->eMenuCount, 'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]), 'setStyle'=>$this->eSetStyle)); } else { - tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea,'menuCount'=>$this->eMenuCount,'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]),'setStyle'=>$this->eSetStyle)); + tablestyle($caption, $text, $mode, array('uniqueId'=>$this->uniqueId, 'menuArea'=>$this->eMenuArea,'menuCount'=>$this->eMenuCount,'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]),'setStyle'=>$this->eSetStyle)); } + $this->uniqueId = null; } diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index abf963a7b..116d6e02e 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -440,7 +440,7 @@ class page_admin_ui extends e_admin_ui LEFT JOIN #user AS u ON p.page_author = u.user_id LEFT JOIN #page_chapters AS pch ON p.page_chapter = pch.chapter_id LEFT JOIN #page_chapters AS pbk ON pch.chapter_parent = pbk.chapter_id - WHERE p.page_title != '' "; // without any Order or Limit. + WHERE (p.page_title != '' OR p.page_text != '') "; // without any Order or Limit. //protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}"; protected $pid = "page_id"; diff --git a/e107_admin/notify.php b/e107_admin/notify.php index cea0a87fa..d23fd8033 100644 --- a/e107_admin/notify.php +++ b/e107_admin/notify.php @@ -23,6 +23,502 @@ if (!getperms('O')) } include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); + + + +class plugin_notify_admin extends e_admin_dispatcher +{ + + protected $modes = array( + 'main' => array('controller' => 'plugin_notify_admin_ui', + 'path' => null, + 'ui' => 'plugin_notify_admin_form_ui', 'uipath' => null) + ); + + protected $adminMenu = array( + 'main/config' => array('caption'=> "Email", 'perm' => '0'), + 'main/push' => array('caption'=> "Push (experimental)", 'perm' => '0') + ); + + protected $adminMenuAliases = array( + 'main/edit' => 'main/list' + ); + + /** + * Navigation menu title + * @var string + */ + protected $menuTitle = NT_LAN_1; + + function init() + { + if(e_DEBUG !== true) + { + unset($this->adminMenu['main/push']); + } + + + + } +} + + + +class plugin_notify_admin_ui extends e_admin_ui +{ + protected $pluginTitle = NT_LAN_1; + + protected $pluginName = 'core'; + + protected $table = ""; + + protected $listQry = ""; + + protected $pid = "notify_id"; + + protected $perPage = 20; + + protected $batchDelete = true; + + // protected $displaySettings = array(); + + // protected $disallowPages = array('main/create', 'main/prefs'); + + + protected $fields = array(); + + //required - default column user prefs + protected $fieldpref = array(); + + + // optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName); + protected $prefs = array( + /* 'pref_type' => array('title'=> 'type', 'type'=>'text', 'data' => 'string', 'validate' => true), + 'pref_folder' => array('title'=> 'folder', 'type' => 'boolean', 'data' => 'integer'), + 'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')*/ + ); + + var $notify_prefs; + var $changeList = array(); + var $pluginConfig = array(); + + function init() + { + + + if(!empty($_POST['update'])) + { + if($this-> update()) + { + // e107::getMessage()->addSuccess(LAN_UPDATED); + } + else + { + e107::getMessage()->addError(LAN_UPDATED_FAILED); + } + + } + + + $pref = e107::getPref(); + $this->notify_prefs = e107::getConfig('notify')->getPref(); + + $this->prefCleanup(); + $this->test(); + + $recalibrate = FALSE; + + // load every e_notify.php file. + if($pref['e_notify_list']) + { + foreach($pref['e_notify_list'] as $val) // List of available e_notify.php files. + { + // if (!isset($this->notify_prefs['plugins'][$val])) + { + + $this -> notify_prefs['plugins'][$val] = TRUE; + + if (is_readable(e_PLUGIN.$val."/e_notify.php")) + { + require_once(e_PLUGIN.$val.'/e_notify.php'); + + if(class_exists($val."_notify")) // new v2.x + { + $legacy = 0; // Newe. + $config_events = array(); + + $data = e107::callMethod($val."_notify", 'config'); + + $config_category = str_replace("_menu","",ucfirst($val))." Events"; + + foreach($data as $v) + { + $func = $v['function']; + $config_events[$func] = $v['name']; + } + + } + else + { + $legacy = 1; // Legacy Mode. + } + + // foreach ($config_events as $event_id => $event_text) + // { + // $this -> notify_prefs['event'][$event_id] = array('class' => '255', 'email' => '', 'plugin'=> $val); + + // } + $this->pluginConfig[$val] = array('category' => $config_category, 'events' => $config_events, 'legacy'=> $legacy); + $recalibrate = true; + } + } + } + } + + // print_a($this->pluginConfig); + + if ($recalibrate) + { + // $s_prefs = $tp -> toDB($this -> notify_prefs); + // $s_prefs = $eArrayStorage -> WriteArray($s_prefs); + // $sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'"); + } + } + + + + + + function prefCleanup() + { + $oldPrefs = e107::getEvent()->oldCoreList(); + $curData = $this->notify_prefs['event']; + + foreach($curData as $k=>$v) + { + if(isset($oldPrefs[$k])) + { + $newKey = $oldPrefs[$k]; + $this->notify_prefs['event'][$newKey] = $v; + unset($this->notify_prefs['event'][$k]); + } + + } + + } + + + + + function pushPage() + { + + e107::getMessage()->addInfo("Under Construction"); + + + + + } + + + function test() + { + if(!empty($_POST['test'])) + { + $id = key( $_POST['test']); + $exampleData = array('id'=>'Test for '.$id, 'data'=>'example data' ); + e107::getMessage()->addSuccess('Triggering: '.$id); + e107::getEvent()->trigger($id, $exampleData); + } + + + } + + + + function configPage() + { + //global $ns, $rs, $frm, $emessage; + $ns = e107::getRender(); + $frm = e107::getForm(); + $mes = e107::getMessage(); + + + $events = e107::getEvent()->coreList(); + $tab = array(); + + foreach($events as $k=>$cat) + { + $text = "