Example #1
0
 function upgrade_post($param)
 {
     $mes = eMessage::getInstance();
     if ($this->insertDefaultCategory(TRUE)) {
         $mes->add(EC_ADINST_LAN_06, E_MESSAGE_SUCCESS);
     } else {
         $mes->add(EC_ADINST_LAN_07, E_MESSAGE_ERROR);
     }
 }
Example #2
0
 /**
  * Save preset
  *
  * @param string $exclude_fields Comma separated list of fields not to save
  * @param bool $output output message or use message handler. NOTE - default value will be changed to false, update your code.
  */
 function save_preset($exclude_fields = '', $output = true)
 {
     global $sql, $ns, $tp;
     $qry = explode(".", e_QUERY);
     $unique_id = is_array($this->id) ? $this->id : array($this->id);
     $uid = $tp->toDB(varset($qry[1], 0));
     if ($_POST && $qry[0] == "savepreset") {
         $saveID = $tp->toDB($unique_id[$uid], true);
         $exclude_array = explode(',', $exclude_fields);
         $existing = $sql->db_Count("preset", "(*)", " WHERE preset_name='" . $saveID . "'  ") ? TRUE : FALSE;
         foreach ($_POST as $key => $value) {
             if (in_array($key, $exclude_array) || $tp->toDB($key) != $key) {
                 unset($_POST[$key]);
                 // Remove any fields excluded from preset, and those with potentially dubious key names
             } else {
                 $_POST[$key] = $tp->toDB($value);
             }
         }
         if ($existing) {
             // Delete any existing entries for this preset (else checkbox settings not updated)
             $sql->db_Delete("preset", "preset_name ='" . $saveID . "' ");
         }
         foreach ($_POST as $key => $value) {
             $sql->db_Insert("preset", "0, '" . $saveID . "', '{$key}', '{$value}' ");
         }
         if (!$output) {
             $ns->tablerender(LAN_SAVED, LAN_PRESET_SAVED);
             return;
         }
         require_once e_HANDLER . "message_handler.php";
         $emessage =& eMessage::getInstance();
         $emessage->add(LAN_PRESET_SAVED, E_MESSAGE_SUCCESS);
     }
     if ($_POST['delete_preset'] && e_QUERY == "clr_preset") {
         $del = $tp->toDB($_POST['del_id']);
         $check = $sql->db_Delete("preset", "preset_name ='" . $unique_id[$del] . "' ");
         if ($output) {
             $ns->tablerender(LAN_SAVED, $check ? LAN_PRESET_DELETED : LAN_DELETED_FAILED);
             return;
         }
         require_once e_HANDLER . "message_handler.php";
         $emessage =& eMessage::getInstance();
         if ($check) {
             $emessage->add(LAN_PRESET_DELETED, E_MESSAGE_SUCCESS);
         } else {
             $emessage->add(LAN_DELETED_FAILED, E_MESSAGE_ERROR);
         }
     }
 }
Example #3
0
 /**
  * Send AJAX Json Response Output - default method
  * It's fully compatible with the core dialog.js
  * @param array $override override output associative array (header, body and footer keys)
  * @param string $ns namespace/segment
  * @param bool $render_message append system messages
  */
 function sendJson($override = array(), $ns = null, $render_message = true)
 {
     if (!$ns) {
         $ns = 'default';
     }
     $content = $this->getBody($ns, true);
     // separate render parameter for json response, false by default
     $render = $this->getParam('jsonRender');
     if ($render_message) {
         $content = eMessage::getInstance()->render() . $content;
     }
     //render disabled by the controller
     if (!$this->getRenderMod($ns)) {
         $render = false;
     }
     $title = '';
     if (!$this->getParam('jsonNoTitle')) {
         $titleArray = $this->_title;
         $title = isset($titleArray[$ns]) ? array_pop($titleArray[$ns]) : '';
     }
     if ($render) {
         $render = e107::getRender();
         $content = $render->tablerender($this->getTitle($ns, true), $content, $this->getRenderMod($ns), true);
     }
     $jshelper = e107::getJshelper();
     $override = array_merge(array('header' => $title, 'body' => $content, 'footer' => $statusText), $override);
     echo $jshelper->buildJsonResponse($override);
     $jshelper->sendJsonResponse(null);
 }
Example #4
0
File: db.php Project: notzen/e107
 /**
  * Import XML Dump
  * @return none
  */
 private function importXmlFile()
 {
     $ret = e107::getSingleton('xmlClass')->e107Import($_FILES['file_userfile']['tmp_name'][0]);
     foreach ($ret['success'] as $table) {
         eMessage::getInstance()->add("Inserted {$table}", E_MESSAGE_SUCCESS);
     }
     foreach ($ret['failed'] as $table) {
         eMessage::getInstance()->add("Failed to Insert {$table}", E_MESSAGE_ERROR);
     }
 }
Example #5
0
 /**
  *
  * @param object $path [unused]
  * @param object $what install|uninstall|upgrade
  * @param object $when pre|post
  * @return boolean FALSE
  */
 function execute_function($path = '', $what = '', $when = '')
 {
     $mes = eMessage::getInstance();
     $class_name = $this->plugFolder . "_setup";
     $method_name = $what . "_" . $when;
     if (varset($this->plug_vars['@attributes']['setupFile'])) {
         $setup_file = e_PLUGIN . $this->plugFolder . '/' . $this->plug_vars['@attributes']['setupFile'];
     } else {
         $setup_file = e_PLUGIN . $this->plugFolder . '/' . $this->plugFolder . '_setup.php';
     }
     if (is_readable($setup_file)) {
         $mes->add("Found setup file <b>" . $setup_file . "</b> ", E_MESSAGE_DEBUG);
         include_once $setup_file;
         if (class_exists($class_name)) {
             $obj = new $class_name();
             $obj->version_from = $this;
             if (method_exists($obj, $method_name)) {
                 $mes->add("Executing setup function <b>" . $method_name . "()</b>", E_MESSAGE_DEBUG);
                 return call_user_func(array($obj, $method_name), $this);
             } else {
                 $mes->add("Setup function <b>" . $method_name . "()</b> NOT found.", E_MESSAGE_DEBUG);
                 return FALSE;
             }
         } else {
             $mes->add("Setup function <b>" . $method_name . "()</b> NOT found.", E_MESSAGE_DEBUG);
             return FALSE;
         }
     } else {
         $mes->add("Optional Setup File NOT Found <b>" . $setup_file . "</b> ", E_MESSAGE_DEBUG);
     }
     $mes->add("Setup function <b>" . $method_name . "()</b> NOT found.", E_MESSAGE_DEBUG);
     return FALSE;
     // IMPORTANT.
 }
Example #6
0
 function deleteRecord($id)
 {
     if (!$id || !$this->primary || !$this->table) {
         return;
     }
     $emessage = eMessage::getInstance();
     $sql = e107::getDb();
     $query = $this->primary . " = " . $id;
     $status = $sql->db_Delete($this->table, $query) ? E_MESSAGE_SUCCESS : E_MESSAGE_FAILED;
     $message = LAN_DELETED;
     $emessage->add($message, $status);
 }
Example #7
0
 public function releaseCheck($mode = 'plugin', $cache = TRUE)
 {
     global $e107cache;
     if (!$this->getOption('releaseUrl')) {
         return;
     }
     $cacheString = $mode . 'UpdateCheck';
     $e107cache->CachePageMD5 = md5($cacheString . $this->getOption('curFolder') . $this->getOption('curVersion', 1.0));
     if ($cache == TRUE && ($cacheData = $e107cache->retrieve($cacheString, 3600, TRUE))) {
         require_once e_HANDLER . "message_handler.php";
         $emessage =& eMessage::getInstance();
         $emessage->add($cacheData);
         $e107cache->CachePageMD5 = "";
         return;
     }
     $xml = e107::getXml();
     $feed = $this->getOption('releaseUrl');
     if (substr($feed, -4) == ".php") {
         $feed .= "?folder=" . $this->getOption('curFolder') . "&version=" . $this->getOption('curVersion');
     }
     if ($rawData = $xml->loadXMLfile($feed, TRUE)) {
         if (!$rawData[$mode][1]) {
             $rawData[$mode] = $rawData;
         }
         $txt = "";
         $lan_text = $mode == "theme" ? ADLAN_162 : ADLAN_163;
         foreach ($rawData[$mode] as $val) {
             $name = $val['@attributes']['name'];
             $folder = $val['@attributes']['folder'];
             $version = $val['@attributes']['version'];
             $url = $val['@attributes']['url'];
             if ($folder == $this->getOption('curFolder') && version_compare($version, $this->getOption('curVersion')) == 1) {
                 $txt .= $lan_text . " <a href='" . $url . "'>" . $name . " v" . $version . "</a><br />";
                 break;
             }
         }
         if ($txt) {
             require_once e_HANDLER . "message_handler.php";
             $emessage =& eMessage::getInstance();
             $emessage->add($txt);
             if ($cache == TRUE) {
                 $e107cache->set($cacheString, $txt, TRUE);
             }
             $e107cache->CachePageMD5 = "";
         }
     }
 }
Example #8
0
 function delete_extended($_name)
 {
     global $ue, $admin_log;
     $emessage = eMessage::getInstance();
     if ($ue->user_extended_remove($_name, $_name)) {
         $admin_log->log_event('EUF_07', $_name, E_LOG_INFORMATIVE, '');
         $emessage->add(EXTLAN_30 . " [" . $_name . "]", E_MESSAGE_SUCCESS);
         e107::getCache()->clear_sys('user_extended_struct', true);
     } else {
         $emessage->add(LAN_ERROR . " [" . $_name . "]", E_MESSAGE_ERROR);
     }
 }
Example #9
0
 function show_create_item()
 {
     $pref = e107::getPref();
     $this->_pre_create();
     require_once e_HANDLER . "userclass_class.php";
     //	require_once(e_HANDLER."form_handler.php");
     //	$frm = new e_form(true); //enable inner tabindex counter
     $frm = e107::getForm();
     $text = '';
     if (isset($_POST['preview'])) {
         $text = $this->preview_item($this->getId());
     }
     $sub_action = $this->getSubAction();
     $id = $this->getSubAction() != 'sn' && $this->getSubAction() != 'upload' ? $this->getId() : 0;
     $e107 = e107::getInstance();
     $tp = e107::getParser();
     $sql = e107::getDb();
     if ($sub_action == "sn" && !varset($_POST['preview'])) {
         if ($sql->db_Select("submitnews", "*", "submitnews_id=" . $this->getId(), TRUE)) {
             //list($id, $submitnews_name, $submitnews_email, $_POST['news_title'], $submitnews_category, $_POST['news_body'], $submitnews_datestamp, $submitnews_ip, $submitnews_auth, $submitnews_file) = $sql->db_Fetch();
             $row = $sql->db_Fetch();
             $_POST['news_title'] = $row['submitnews_title'];
             $_POST['news_body'] = $row['submitnews_item'];
             $_POST['cat_id'] = $row['submitnews_category'];
             if (defsettrue('e_WYSIWYG')) {
                 if (substr($_POST['news_body'], -7, 7) == '[/html]') {
                     $_POST['news_body'] = substr($_POST['news_body'], 0, -7);
                 }
                 if (substr($_POST['news_body'], 0, 6) == '[html]') {
                     $_POST['news_body'] = substr($_POST['news_body'], 6);
                 }
                 $_POST['news_body'] .= "<br /><b>" . NWSLAN_49 . " {$row['submitnews_name']}</b>";
                 $_POST['news_body'] .= $row['submitnews_file'] ? "<br /><br /><img src='{e_NEWSIMAGE}{$row['submitnews_file']}' class='f-right' />" : '';
             } else {
                 $_POST['news_body'] .= "\n[[b]" . NWSLAN_49 . " {$row['submitnews_name']}[/b]]";
                 $_POST['news_body'] .= $row['submitnews_file'] ? "\n\n[img]{e_NEWSIMAGE}{$row['submitnews_file']}[/img]" : "";
             }
             $_POST['data'] = $tp->dataFilter($_POST['data']);
             // Filter any nasties
             $_POST['news_title'] = $tp->dataFilter($_POST['news_title']);
         }
     }
     /*
     
     		if ($sub_action == "upload" && !varset($_POST['preview']))
     		{
     			if ($sql->db_Select('upload', '*', "upload_id=".$this->getId())) {
     				$row = $sql->db_Fetch();
     				$post_author_id = substr($row['upload_poster'], 0, strpos($row['upload_poster'], "."));
     				$post_author_name = substr($row['upload_poster'], (strpos($row['upload_poster'], ".")+1));
     				$match = array();
     				//XXX DB UPLOADS STILL SUPPORTED?
     				$upload_file = "pub_" . (preg_match('#Binary\s(.*?)\/#', $row['upload_file'], $match) ? $match[1] : $row['upload_file']);
     				$_POST['news_title'] = LAN_UPLOAD.": ".$row['upload_name'];
     				$_POST['news_body'] = $row['upload_description']."\n[b]".NWSLAN_49." [link=".$e107->url->create('user/profile/view', 'id='.$post_author_id.'&name='.$post_author_name)."]".$post_author_name."[/link][/b]\n\n[file=request.php?".$upload_file."]{$row['upload_name']}[/file]\n";
     			}
     		}
     */
     $text .= "\n\t\t<div class='admintabs' id='tab-container'>\n\t\t\t<ul class='e-tabs' id='core-emote-tabs'>\n\t\t\t\t<li id='tab-general'><a href='#core-newspost-create'>" . LAN_NEWS_52 . "</a></li>\n\t\t\t\t<li id='tab-seo'><a href='#core-newspost-seo'>SEO</a></li>\n\t\t\t\t<li id='tab-advanced'><a href='#core-newspost-edit-options'>" . LAN_NEWS_53 . "</a></li>\n\t\t\t</ul>\n\t\t\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "' id='core-newspost-create-form' " . (FILE_UPLOADS ? "enctype='multipart/form-data'" : "") . " >\n\t\t\t\t<fieldset id='core-newspost-create'>\n\t\t\t\t\t<legend>" . LAN_NEWS_52 . "</legend>\n\t\t\t\t\t<table class='table adminform'>\n\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t<col class='col-label' />\n\t\t\t\t\t\t\t<col class='col-control' />\n\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . NWSLAN_6 . ": </td>\n\t\t\t\t\t\t\t\t<td>\n\t\t";
     if (!$this->news_categories) {
         $text .= NWSLAN_10;
     } else {
         // $text .= $frm->selectbox("cat_id",$this->news_category,$_POST['cat_id']);
         $text .= $frm->select_open('cat_id');
         foreach ($this->news_categories as $row) {
             $text .= $frm->option($tp->toHTML($row['category_name'], FALSE, "LINKTEXT"), $row['category_id'], varset($_POST['cat_id']) == $row['category_id']);
         }
         $text .= "</select>";
     }
     $text .= "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . NWSLAN_12 . ":</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type='text' name='news_title' value=\"" . $tp->post_toForm($_POST['news_title']) . "\" class='tbox' style='width:90%' required='required' />\n\t\t\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . LAN_NEWS_27 . ":</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type='text' name='news_summary' value=\"" . $tp->post_toForm($_POST['news_summary']) . "\" class='tbox' style='width:90%' />\n\t\t\t\t\t\t\t\t\t" . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . LAN_TEMPLATE . ":</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t";
     //XXX multiple-selections at once. (comma separated) - working
     $text .= $frm->selectbox('news_render_type', $this->news_renderTypes, $_POST['news_render_type'], "multiple=1", array(NWSLAN_74)) . "\n\t\t\t\t\t\t\t\t\t\t<div class='field-help'>\n\t\t\t\t\t\t\t\t\t\t\t" . NWSLAN_74 . "\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t";
     // -------- News Author ---------------------
     $text .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . LAN_NEWS_50 . ":</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t";
     if (!getperms('0') && !check_class($pref['news_editauthor'])) {
         $auth = $_POST['news_author'] ? intval($_POST['news_author']) : USERID;
         $e107->sql->db_Select("user", "user_name", "user_id={$auth} LIMIT 1");
         $row = $e107->sql->db_Fetch(MYSQL_ASSOC);
         $text .= "<input type='hidden' name='news_author' value='" . $auth . chr(35) . $row['user_name'] . "' />";
         $text .= "<a href='" . $e107->url->create('user/profile/view', 'name=' . $row['user_name'] . '&id=' . $_POST['news_author']) . "'>" . $row['user_name'] . "</a>";
     } else {
         $text .= $frm->select_open('news_author');
         $qry = "SELECT user_id,user_name FROM #user WHERE user_perms = '0' OR user_perms = '0.' OR user_perms REGEXP('(^|,)(H)(,|\$)') ";
         if ($pref['subnews_class'] && $pref['subnews_class'] != e_UC_GUEST && $pref['subnews_class'] != e_UC_NOBODY) {
             if ($pref['subnews_class'] == e_UC_MEMBER) {
                 $qry .= " OR user_ban != 1";
             } elseif ($pref['subnews_class'] == e_UC_ADMIN) {
                 $qry .= " OR user_admin = 1";
             } else {
                 $qry .= " OR FIND_IN_SET(" . intval($pref['subnews_class']) . ", user_class) ";
             }
         }
         $sql->db_Select_gen($qry);
         while ($row = $sql->db_Fetch()) {
             if ($_POST['news_author']) {
                 $sel = $_POST['news_author'] == $row['user_id'];
             } else {
                 $sel = USERID == $row['user_id'];
             }
             $text .= $frm->option($row['user_name'], $row['user_id'] . chr(35) . $row['user_name'], $sel);
         }
         $text .= "</select>\n\t\t\t";
     }
     $text .= "</td></tr>\n";
     // -----
     $text .= "<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td colspan='2'>\n";
     $text .= "<div class='e-tabs'>\n\t\t<ul>\n\t\t\t<li><a href='#news-body-container'>" . NWSLAN_13 . "</a></li>\n\t\t\t<li><a href='#news-extended-container'>" . NWSLAN_14 . "</a></li>\n\t\t</ul>";
     $val = strstr($tp->post_toForm($_POST['news_body']), "[img]http") ? $tp->post_toForm($_POST['news_body']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_body']));
     $text .= "<div id='news-body-container' class='e-tab'>";
     $text .= $frm->bbarea('news_body', $val, 'news', 'news');
     $text .= "</div><div id='news-extended-container' class='t-container'>";
     $val = strstr($tp->post_toForm($_POST['news_extended']), "[img]http") ? $tp->post_toForm($_POST['news_extended']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_extended']));
     $text .= $frm->bbarea('news_extended', $val, 'extended', 'news', 'large');
     $text .= "</div>\n\t\t\t</div></td></tr>";
     //-----------
     /*		
     			$text .= "
     						<tr>
     							<td>".NWSLAN_13.":<br /></td>
     							<td>
     							
     							";
     
     	$val = (strstr($tp->post_toForm($_POST['news_body']), "[img]http") ? $tp->post_toForm($_POST['news_body']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_body'])));
             $text .= $frm->bbarea('news_body', $val, 'news', 'helpb');
     
     	// Extended news form textarea
     	// Fixes Firefox issue with hidden wysiwyg textarea.
     	// XXX - WYSIWYG is already plugin, this should go
       //		if(defsettrue('e_WYSIWYG')) $ff_expand = "tinyMCE.execCommand('mceResetDesignMode')";
     	$val = (strstr($tp->post_toForm($_POST['news_extended']), "[img]http") ? $tp->post_toForm($_POST['news_extended']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_extended'])));
     	$text .= "
     							</td>
     						</tr>
     						<tr>
     							<td>".NWSLAN_14.":</td>
     							<td>
     								".$frm->bbarea('news_extended', $val, 'extended', 'helpc')."
     								<!-- <div class='field-help'>".NWSLAN_83."</div> -->
     							</td>
     						</tr>";
     					/*
     	/*
     						
     			$text .= "
     								<tr>
     									<td>".NWSLAN_66.":</td>
     									<td>";
     	
     			$text .= $frm->mediaUrl('news', NWSLAN_69);
     	
     			$text .= "
     									</td>
     								</tr>";
     */
     $text .= "\n\t\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td>" . NWSLAN_67 . ":<br />\n\t\t\t\t\t\t\t\t\t\t" . $frm->help(LAN_NEWS_23) . "</td>\n\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t";
     if (vartrue($_POST['news_thumbnail']) && $_POST['news_thumbnail'][0] != "{") {
         $_POST['news_thumbnail'] = "{e_IMAGE}newspost_images/" . $_POST['news_thumbnail'];
     }
     $text .= $frm->imagepicker('news_thumbnail', $_POST['news_thumbnail'], '', 'news');
     $text .= "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</fieldset>\n\t\t";
     //BEGIN SEO block
     $text .= "\n\t\t\t\t<fieldset id='core-newspost-seo'>\n\t\t\t\t\t<legend>SEO</legend>\n\t\t\t\t\t<table class='table adminform'>\n\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t<col class='col-label' />\n\t\t\t\t\t\t\t<col class='col-control' />\n\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>Friendly URL string: </td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . $frm->text('news_sef', $tp->post_toForm($_POST['news_sef']), 255) . "\n\t\t\t\t\t\t\t\t\t<div class='field-help'>If left empty will be automatically created from current News Title based on your current <a href='" . e_ADMIN_ABS . "eurl.php?mode=main&amp;action=settings' title='To URL settings area' rel='external'>URL settings</a></div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . LAN_KEYWORDS . ": </td>\n\t\t\t\t\t\t\t\t<td>" . $frm->tags('news_meta_keywords', $tp->post_toForm($_POST['news_meta_keywords']), 255) . "\n\t\t\t\t\t\t\t\t<div class='field-help'>Keywords/tags associated to associate with this news item</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\n\t\t\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>Meta description: </td>\n\t\t\t\t\t\t\t\t<td>" . $frm->textarea('news_meta_description', $tp->post_toForm($_POST['news_meta_description']), 7) . "</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</fieldset>\n\t\t";
     //BEGIN Options block
     $text .= "\n\t\t\t\t<fieldset id='core-newspost-edit-options'>\n\t\t\t\t\t<legend>" . LAN_NEWS_53 . "</legend>\n\t\t\t\t\t<table class='table adminform'>\n\t\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t\t<col class='col-label' />\n\t\t\t\t\t\t\t<col class='col-control' />\n\t\t\t\t\t\t</colgroup>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . NWSLAN_15 . ":</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t" . $frm->radio('news_allow_comments', 0, !$_POST['news_allow_comments']) . "" . $frm->label(LAN_ENABLED, 'news_allow_comments', 0) . "&nbsp;&nbsp;\n\t\t\t\t\t\t\t\t\t" . $frm->radio('news_allow_comments', 1, $_POST['news_allow_comments']) . "" . $frm->label(LAN_DISABLED, 'news_allow_comments', 1) . "\n\t\t\t\t\t\t\t\t\t<div class='field-help'>\n\t\t\t\t\t\t\t\t\t\t" . NWSLAN_18 . "\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>" . NWSLAN_19 . ":</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'>" . NWSLAN_21 . ":</div>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'>\n\t\t";
     $text .= $frm->datepicker("news_start", $_POST['news_start'], "type=datetime");
     $text .= " - ";
     $text .= $frm->datepicker("news_end", $_POST['news_end'], "type=datetime");
     $text .= "</div>\n\t\t\t\t\t\t\t\t\t\t<div class='field-help'>\n\t\t\t\t\t\t\t\t\t\t\t" . NWSLAN_72 . "\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>" . LAN_NEWS_32 . ":</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'>\n\t\t";
     $text .= $frm->datepicker("news_datestamp", $_POST['news_datestamp'], "type=datetime");
     $text .= "</div>";
     /*
     		
     $text .= "<div class='field-spacer'>
     		".$frm->checkbox('update_datestamp', '1', $_POST['update_datestamp']).$frm->label(NWSLAN_105, 'update_datestamp', '1')."
     		</div>
     		<div class='field-help'>
     		".LAN_NEWS_33."
     		</div>";
     */
     $text .= "\n\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t";
     // --------------------- News Userclass ---------------------------
     $text .= "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>" . NWSLAN_22 . ":</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t" . $frm->uc_select('news_userclass[]', vartrue($_POST['news_class'], 0), 'nobody,public,guest,member,admin,classes,language', 'description=1&multiple=1') . "\n\t\t\t\t\t\t\t\t\t\t<div class='field-help'>\n\t\t\t\t\t\t\t\t\t\t\t" . NWSLAN_84 . "\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>" . LAN_NEWS_28 . ":</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t" . $frm->checkbox('news_sticky', '1', $_POST['news_sticky']) . $frm->label(LAN_NEWS_29, 'news_sticky', '1') . "\n\t\t\t\t\t\t\t\t\t\t<div class='field-help'>\n\t\t\t\t\t\t\t\t\t\t\t" . LAN_NEWS_30 . "\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t";
     if ($pref['trackbackEnabled']) {
         $text .= "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>" . LAN_NEWS_34 . ":</td>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<a class='e-pointer' onclick='expandit(this);'>" . LAN_NEWS_35 . "</a>\n\t\t\t\t\t\t\t\t\t\t<div class='e-hideme'>\n\t\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class='smalltext'>" . LAN_NEWS_37 . "</span>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'>\n\t\t\t\t\t\t\t\t\t\t\t\t<textarea class='tbox textarea' name='trackback_urls' style='width:95%' cols='80' rows='5'>" . $_POST['trackback_urls'] . "</textarea>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t";
     }
     //triggerHook
     $data = array('method' => 'form', 'table' => 'news', 'id' => $id, 'plugin' => 'news', 'function' => 'create_item');
     $hooks = e107::getEvent()->triggerHook($data);
     if (!empty($hooks)) {
         $text .= "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td colspan='2' >" . LAN_HOOKS . " </td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t";
         foreach ($hooks as $hook) {
             if (!empty($hook)) {
                 $text .= "\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>" . $hook['caption'] . "</td>\n\t\t\t\t\t\t\t\t\t<td>" . $hook['text'] . "</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t";
             }
         }
     }
     $text .= "\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</fieldset>\n\t\t\t\t<div class='buttons-bar center'>\n\t\t\t\t\t" . $frm->admin_button('preview', isset($_POST['preview']) ? NWSLAN_24 : NWSLAN_27, 'other') . "\n\t\t\t\t\t" . $frm->admin_button('submit_news', $id && $sub_action != "sn" && $sub_action != "upload" ? NWSLAN_25 : NWSLAN_26, 'update') . "\n\t\t\t\t\t" . $frm->checkbox('create_edit_stay', 1, isset($_POST['create_edit_stay'])) . $frm->label(LAN_NEWS_54, 'create_edit_stay', 1) . "\n\t\t\t\t\t<input type='hidden' name='news_id' value='{$id}' />\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t</div>\n\n\t\t";
     $emessage = eMessage::getInstance();
     echo $emessage->render() . $text;
     // $e107->ns->tablerender($this->getSubAction() == 'edit' ? NWSLAN_29a : NWSLAN_29, $emessage->render().$text);
 }
Example #10
0
 function show_prefs()
 {
     global $fPref, $ns, $sql;
     $e107 = e107::getInstance();
     $emessage = eMessage::getInstance();
     $poll_installed = plugInstalled('poll');
     if (!$poll_installed) {
         if ($fPref->get('poll') == 1) {
             $fPref['forum_poll'] = e_UC_NOBODY;
             $fPref->save(false, true);
         }
     }
     $text = "<div style='text-align:center'>\n\t\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "'>\n\n\t\t<table style='" . ADMIN_WIDTH . "' class='fborder'>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_44 . "<br /><span class='smalltext'>" . FORLAN_45 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' >" . ($fPref->get('enclose') ? "<input type='checkbox' name='forum_enclose' value='1' checked='checked' />" : "<input type='checkbox' name='forum_enclose' value='1' />") . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_65 . "<br /><span class='smalltext'>" . FORLAN_46 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_title' size='15' value='" . $fPref->get('title') . "' maxlength='100' /></td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_47 . "<br /><span class='smalltext'>" . FORLAN_48 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' >" . ($fPref->get('notify') ? "<input type='checkbox' name='email_notify' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify' value='1' />") . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_177 . "<br /><span class='smalltext'>" . FORLAN_178 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' >" . ($fPref->get('notify_on') ? "<input type='checkbox' name='email_notify_on' value='1' checked='checked' />" : "<input type='checkbox' name='email_notify_on' value='1' />") . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_49 . "<br /><span class='smalltext'>" . FORLAN_50 . "</span></td>";
     if ($poll_installed) {
         //			<td class='forumheader'>".$e107->user_class->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes')."</td>
         $text .= "<td style='width:25%;text-align:center' class='forumheader3' >" . $e107->user_class->uc_dropdown('forum_poll', $fPref->get('poll'), 'admin,classes') . '</td>';
     } else {
         $text .= "<td style='width:25%;text-align:center' class='forumheader3' >" . FORLAN_66 . "</td>";
     }
     $text .= "\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_70 . "<br /><span class='smalltext'>" . FORLAN_71 . " <a href='" . e_ADMIN . "upload.php'>" . FORLAN_130 . "</a> " . FORLAN_131 . "</span>";
     if (!$pref['image_post']) {
         $text .= "<br /><b>" . FORLAN_139 . "</b>";
     }
     if (!is_writable(e_PLUGIN . 'forum/attachments')) {
         $text .= "<br /><b>Attachment dir (" . e_PLUGIN_ABS . 'forum/attachments' . ") is not writable!</b>";
     }
     $text .= "</td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' >" . ($fPref->get('attach') ? "<input type='checkbox' name='forum_attach' value='1' checked='checked' />" : "<input type='checkbox' name='forum_attach' value='1' />") . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_134 . "<br /><span class='smalltext'>" . FORLAN_135 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' size='3' maxlength='5' name='forum_maxwidth' value='" . $fPref->get('maxwidth') . "' /></td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_136 . "<br /><span class='smalltext'>" . FORLAN_137 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' >" . ($fPref->get('linkimg') ? "<input type='checkbox' name='forum_linkimg' value='1' checked='checked' />" : "<input type='checkbox' name='forum_linkimg' value='1' />") . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_51 . "<br /><span class='smalltext'>" . FORLAN_52 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' >" . ($fPref->get('track') ? "<input type='checkbox' name='forum_track' value='1' checked='checked' />" : "<input type='checkbox' name='forum_track' value='1' />") . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_112 . "<br /><span class='smalltext'>" . FORLAN_113 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' >" . ($fPref->get('redirect') ? "<input type='checkbox' name='forum_redirect' value='1' checked='checked' />" : "<input type='checkbox' name='forum_redirect' value='1' />") . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_116 . "<br /><span class='smalltext'>" . FORLAN_122 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' >" . ($fPref->get('reported_post_email') ? "<input type='checkbox' name='reported_post_email' value='1' checked='checked' />" : "<input type='checkbox' name='reported_post_email' value='1' />") . "</td>\n\t\t</tr>\n\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_126 . "<br /><span class='smalltext'>" . FORLAN_127 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' >" . ($fPref->get('forum_tooltip') ? "<input type='checkbox' name='forum_tooltip' value='1' checked='checked' />" : "<input type='checkbox' name='forum_tooltip' value='1' />") . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_128 . "<br /><span class='smalltext'>" . FORLAN_129 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_tiplength' size='15' value='" . $fPref->get('tiplength') . "' maxlength='20' /></td>\n\t\t</tr>\n\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_53 . "<br /><span class='smalltext'>" . FORLAN_54 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_eprefix' size='15' value='" . $fPref->get('eprefix') . "' maxlength='20' /></td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_55 . "<br /><span class='smalltext'>" . FORLAN_56 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_popular' size='3' value='" . $fPref->get('popular') . "' maxlength='3' /></td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_57 . "<br /><span class='smalltext'>" . FORLAN_58 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_postspage' size='3' value='" . $fPref->get('postspage') . "' maxlength='3' /></td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_186 . "<br /><span class='smalltext'>" . FORLAN_187 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_threadspage' size='3' value='" . $fPref->get('threadspage') . "' maxlength='3' /></td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td style='width:75%' class='forumheader3'>" . FORLAN_132 . "<br /><span class='smalltext'>" . FORLAN_133 . "</span></td>\n\t\t<td style='width:25%;text-align:center' class='forumheader3' >" . ($fPref->get('hilightsticky') ? "<input type='checkbox' name='forum_hilightsticky' value='1' checked='checked' />" : "<input type='checkbox' name='forum_hilightsticky' value='1' />") . "</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td colspan='2'  style='text-align:center' class='forumheader'>\n\t\t<input class='button' type='submit' name='updateoptions' value='" . FORLAN_61 . "' />\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t</div>";
     $ns->tablerender(FORLAN_62, $emessage->render() . $text);
 }
Example #11
0
function poll_list()
{
    $sql = e107::getDb();
    $ns = e107::getRender();
    $tp = e107::getParser();
    $frm = new e_form(true);
    global $user_pref;
    if (isset($_POST['etrigger_ecolumns'])) {
        $user_pref['admin_poll_columns'] = $_POST['e-columns'];
        save_prefs('user');
    }
    $fieldpref = varset($user_pref['admin_poll_columns']) ? $user_pref['admin_poll_columns'] : array("poll_id", "poll_title", "poll_options", "poll_vote_userclass");
    //TODO Add more column options.
    $fields = array('poll_id' => array('title' => ID, 'width' => '5%', 'forced' => TRUE), 'poll_title' => array('title' => POLLAN_3, 'width' => 'auto'), 'poll_options' => array('title' => POLLAN_4, 'type' => 'text', 'width' => 'auto', 'thclass' => 'center'), 'poll_vote_userclass' => array('title' => LAN_USERCLASS, 'type' => 'text', 'width' => 'auto'), 'options' => array('title' => LAN_OPTIONS, 'forced' => TRUE, 'width' => '10%', 'thclass' => 'center last'));
    $text = "<div style='text-align:center'><div>\n\t\t<form action='" . e_SELF . "' method='post' id='del_poll'>";
    if ($poll_total = $sql->db_Select("polls", "*", "poll_type=1")) {
        $text .= "<table class='table adminlist'>";
        $text .= $frm->colGroup($fields, $fieldpref) . $frm->thead($fields, $fieldpref);
        $text .= "<tbody>";
        while ($row = $sql->db_Fetch()) {
            extract($row);
            $text .= "<tr>\n\t\t\t\t<td>{$poll_id}</td>";
            $text .= in_array("poll_title", $fieldpref) ? "<td class='left'>" . $tp->toHTML($poll_title, TRUE, "no_hook, emotes_off, defs") . "</td>" : "";
            $text .= in_array("poll_options", $fieldpref) ? "<td class='left'>" . str_replace(chr(1), "<br />", $poll_options) . "</td>" : "";
            $text .= in_array("poll_comment", $fieldpref) ? "<td>" . ($poll_comment ? LAN_YES : LAN_NO) . "</td>" : "";
            $text .= in_array("poll_vote_userclass", $fieldpref) ? "<td>" . r_userclass_name($poll_vote_userclass) . "</td>" : "";
            $text .= "\n\t\t\t\t<td class='center'>\n\t\t\t\t\t<input type='image' name='edit[{$poll_id}]' value='edit' src='" . ADMIN_EDIT_ICON_PATH . "' alt='" . LAN_EDIT . "' title='" . LAN_EDIT . "' style='border:0px' />\n\t\t\t\t\t<input type='image' name='delete[{$poll_id}]' value='del' onclick=\"return jsconfirm('" . $tp->toJS(LAN_CONFIRMDEL . " [" . $poll_id . "]") . "') \" src='" . ADMIN_DELETE_ICON_PATH . "' alt='" . LAN_DELETE . "' title='" . LAN_DELETE . "' style='border:0px' />\n\t\t\t\t</td>\n\t\t\t\t</tr>";
        }
        $text .= "</tbody></table>";
    } else {
        $text .= "<div style='text-align:center'>" . POLLAN_7 . "</div>";
    }
    $text .= "</form></div></div>";
    $emessage = eMessage::getInstance();
    $ns->tablerender(POLLAN_MENU_CAPTION . " :: " . POLLAN_1, $emessage->render() . $text);
}
Example #12
0
 function user_userclass($userid, $uclass, $mode = FALSE)
 {
     global $admin_log, $e_userclass;
     $sql = e107::getDb();
     $remuser = true;
     $emessage =& eMessage::getInstance();
     if ($_POST['notifyuser'] || $mode !== 'clear') {
         $sql->db_Select("user", "*", "user_id={$userid} ");
         $row = $sql->db_Fetch();
         $curClass = varset($row['user_class']) ? explode(",", $row['user_class']) : array();
     }
     foreach ($uclass as $a) {
         $a = intval($a);
         $this->check_allowed($a);
         if ($a != 0) {
             $curClass[] = $a;
         }
     }
     if ($mode == "remove") {
         $curClass = array_diff($curClass, $uclass);
     }
     if ($mode == "clear") {
         //	$curClass = array();
     }
     $curClass = array_unique($curClass);
     $svar = is_array($curClass) ? implode(",", $curClass) : "";
     if ($sql->db_Update("user", "user_class='" . $svar . "' WHERE user_id={$userid} ") === TRUE) {
         $message = UCSLAN_9;
         if ($_POST['notifyuser']) {
             $message .= "<br />" . UCSLAN_1 . ":</b> " . $row['user_name'] . "<br />";
             require_once e_HANDLER . "mail.php";
             $messaccess = '';
             foreach ($curClass as $a) {
                 if (!isset($e_userclass->fixed_classes[$a])) {
                     $messaccess .= $e_userclass->class_tree[$a]['userclass_name'] . " - " . $e_userclass->class_tree[$a]['userclass_description'] . "\n";
                 }
             }
             if ($messaccess == '') {
                 $messaccess = UCSLAN_12 . "\n";
             }
             $send_to = $row['user_email'];
             $subject = UCSLAN_2;
             $message = UCSLAN_3 . " " . $row['user_name'] . ",\n\n" . UCSLAN_4 . " " . SITENAME . "\n( " . SITEURL . " )\n\n" . UCSLAN_5 . ": \n\n" . $messaccess . "\n" . UCSLAN_10 . "\n" . SITEADMIN . "\n( " . SITENAME . " )";
             //    $admin_log->e_log_event(4,__FILE__."|".__FUNCTION__."@".__LINE__,"DBG","User class change",str_replace("\n","<br />",$message),FALSE,LOG_TO_ROLLING);
             sendemail($send_to, $subject, $message);
         }
         $admin_log->log_event('USET_14', str_replace(array('--UID--', '--CLASSES--'), array($id, $svar), UCSLAN_11), E_LOG_INFORMATIVE);
         $emessage->add($message, E_MESSAGE_SUCCESS);
     } else {
         //	$emessage->add("Update Failed", E_MESSAGE_ERROR);
     }
 }
Example #13
0
 function uninstall_pre($var)
 {
     $sql = e107::getDb();
     $mes = eMessage::getInstance();
     // $mes->add("custom uninstall 'pre' function.", E_MESSAGE_SUCCESS);
 }
Example #14
0
function process_csv($filename, $override_imports, $override_expiry, $separator = ',', $quote = '"')
{
    $sql = e107::getDb();
    $pref['ban_durations'] = e107::getPref('ban_durations');
    $emessage =& eMessage::getInstance();
    //  echo "Read CSV: {$filename} separator: {$separator}, quote: {$quote}  override imports: {$override_imports}  override expiry: {$override_expiry}<br />";
    // Renumber imported bans
    if ($override_imports) {
        $sql->db_Update('banlist', "`banlist_bantype`=" . eIPHandler::BAN_TYPE_TEMPORARY . " WHERE `banlist_bantype` = " . eIPHandler::BAN_TYPE_IMPORTED);
    }
    $temp = file($filename);
    $line_num = 0;
    foreach ($temp as $line) {
        // Process one entry
        $line = trim($line);
        $line_num++;
        if ($line) {
            $fields = explode($separator, $line);
            $field_num = 0;
            $field_list = array('banlist_bantype' => eIPHandler::BAN_TYPE_IMPORTED);
            foreach ($fields as $f) {
                $f = trim($f);
                if (substr($f, 0, 1) == $quote) {
                    if (substr($f, -1, 1) == $quote) {
                        // Strip quotes
                        $f = substr($f, 1, -1);
                        // Strip off the quotes
                    } else {
                        $emessage->add(BANLAN_49 . $line_num, E_MESSAGE_ERROR);
                        return BANLAN_49 . $line_num;
                    }
                }
                // Now handle the field
                $field_num++;
                switch ($field_num) {
                    case 1:
                        // IP address
                        $field_list['banlist_ip'] = e107::getIPHandler()->ipEncode($f);
                        break;
                    case 2:
                        // Original date of ban
                        $field_list['banlist_datestamp'] = parse_date($f);
                        break;
                    case 3:
                        // Expiry of ban - depends on $override_expiry
                        if ($override_expiry) {
                            $field_list['banlist_banexpires'] = parse_date($f);
                        } else {
                            // Use default ban time from now
                            $field_list['banlist_banexpires'] = $pref['ban_durations'][eIPHandler::BAN_TYPE_IMPORTED] ? time() + 60 * 60 * $pref['ban_durations'][eIPHandler::BAN_TYPE_IMPORTED] : 0;
                        }
                        break;
                    case 4:
                        // Original ban type - we always ignore this and force to 'imported'
                        break;
                    case 5:
                        // Ban reason originally generated by E107
                        $field_list['banlist_reason'] = $f;
                        break;
                    case 6:
                        // Any user notes added
                        $field_list['banlist_notes'] = $f;
                        break;
                    default:
                        // Just ignore any others
                }
            }
            $qry = "REPLACE INTO `#banlist` (" . implode(',', array_keys($field_list)) . ") values ('" . implode("', '", $field_list) . "')";
            //	  echo count($field_list)." elements, query: ".$qry."<br />";
            if (!$sql->db_Select_gen($qry)) {
                $emessage->add(BANLAN_50 . $line_num, E_MESSAGE_ERROR);
                return BANLAN_50 . $line_num;
            }
        }
    }
    // Success here - may need to delete old imported bans
    if ($override_imports) {
        $sql->db_Delete('banlist', "`banlist_bantype` = " . eIPHandler::BAN_TYPE_TEMPORARY);
    }
    @unlink($filename);
    // Delete file once done
    $emessage->add(str_replace('--NUM--', $line_num, BANLAN_51) . $filename, E_MESSAGE_SUCCESS);
    return str_replace('--NUM--', $line_num, BANLAN_51) . $filename;
}
Example #15
0
 function menuAddMessage($message, $type = E_MESSAGE_INFO, $session = false)
 {
     $emessage = eMessage::getInstance();
     $emessage->add(array($message, 'menuUi'), $type, $session);
 }
Example #16
0
 function show_message($message, $type = E_MESSAGE_INFO, $session = false)
 {
     // ##### Display comfort ---------
     $emessage =& eMessage::getInstance();
     $emessage->add($message, $type, $session);
 }
Example #17
0
 function __construct()
 {
     global $e107cache, $pref;
     $mes = e107::getMessage();
     /*
     if(deftrue('e_BOOTSTRAP3_ADMIN'))
     {
     	$this->approvedAdminThemes[] = 'bootstrap3';
     }
     */
     require_once e_HANDLER . "form_handler.php";
     //enable inner tabindex counter
     $this->frm = new e_form();
     $this->fl = e107::getFile();
     if (!empty($_POST['upload'])) {
         $unzippedTheme = $this->themeUpload();
     }
     if (!empty($_POST['setUploadTheme']) && !empty($unzippedTheme)) {
         $themeArray = $this->getThemes();
         $this->id = $themeArray[$unzippedTheme]['id'];
         if ($this->setTheme()) {
             $mes->addSuccess(TPVLAN_3);
         } else {
             $mes->addError("Could not change site theme.");
             // TODO LAN
         }
     }
     if (!empty($_POST['installContent'])) {
         $this->installContent($_POST['installContent']);
     }
     $this->themeArray = defined('E107_INSTALL') ? $this->getThemes('xml') : $this->getThemes();
     //     print_a($this -> themeArray);
     foreach ($_POST as $key => $post) {
         if (strstr($key, "preview")) {
             //	$this -> id = str_replace("preview_", "", $key);
             $this->id = key($post);
             $this->themePreview();
         }
         if (strstr($key, "selectmain")) {
             //	$this -> id = str_replace("selectmain_", "", $key);
             $this->id = key($post);
             if ($this->setTheme()) {
                 $mes->addSuccess(TPVLAN_3);
             } else {
                 $mes->addError(TPVLAN_3);
             }
         }
         if (strstr($key, "selectadmin")) {
             $this->id = key($post);
             $this->setAdminTheme();
             $this->refreshPage('admin');
         }
     }
     if (isset($_POST['submit_adminstyle'])) {
         $this->id = $_POST['curTheme'];
         if ($this->setAdminStyle()) {
             eMessage::getInstance()->add(TPVLAN_43, E_MESSAGE_SUCCESS);
         }
         e107::getConfig()->save(true);
     }
     if (isset($_POST['submit_style'])) {
         $this->id = $_POST['curTheme'];
         $this->setLayouts();
         // Update the layouts in case they have been manually changed.
         $this->SetCustomPages($_POST['custompages']);
         $this->setStyle();
         e107::getConfig()->save(true);
     }
     if (isset($_POST['installplugin'])) {
         $key = key($_POST['installplugin']);
         include_lan(e_LANGUAGEDIR . e_LANGUAGE . "/admin/lan_plugin.php");
         require_once e_HANDLER . "plugin_class.php";
         $eplug = new e107plugin();
         $message = $eplug->install_plugin($key);
         $mes->add($message, E_MESSAGE_SUCCESS);
     }
     if (isset($_POST['setMenuPreset'])) {
         $key = key($_POST['setMenuPreset']);
         include_lan(e_LANGUAGEDIR . e_LANGUAGE . "/admin/lan_menus.php");
         require_once e_HANDLER . "menumanager_class.php";
         $men = new e_menuManager();
         $men->curLayout = $key;
         //menu_layout is left blank when it's default.
         $men->dbLayout = $men->curLayout != $pref['sitetheme_deflayout'] ? $men->curLayout : "";
         if ($areas = $men->menuSetPreset()) {
             foreach ($areas as $val) {
                 $ar[$val['menu_location']][] = $val['menu_name'];
             }
             foreach ($ar as $k => $v) {
                 $message .= MENLAN_14 . " " . $k . " : " . implode(", ", $v) . "<br />";
             }
             $mes->add(MENLAN_43 . " : " . $key . "<br />" . $message, E_MESSAGE_SUCCESS);
         }
     }
 }
Example #18
0
 *	Admin-related functions for custom page and menu creation
*/
require_once '../class2.php';
if (!getperms("5|J")) {
    header('location:' . e_ADMIN . 'admin.php');
    exit;
}
e107::css('inline', "\n\n.e-wysiwyg { height: 400px }\n");
include_lan(e_LANGUAGEDIR . e_LANGUAGE . '/admin/lan_' . e_PAGE);
$e_sub_cat = 'custom';
require_once e_HANDLER . 'userclass_class.php';
require_once e_HANDLER . 'message_handler.php';
require_once e_HANDLER . 'form_handler.php';
$frm = new e_form(true);
$emessage = eMessage::getInstance();
// $page = new page;
/*
if (e_QUERY)
{
	$tmp        = explode(".", e_QUERY);
	$action     = $tmp[0];
	$sub_action = varset($tmp[1]);
	$id         = intval(varset($tmp[2], 0));
	$from       = intval(varset($tmp[3], 0));
}
*/
/*
if(isset($_POST['delete']) || varset($_POST['etrigger_delete']))
{
	if($_POST['etrigger_delete'])
Example #19
0
/**
 *	Master routine to call to check for updates
 */
function update_check()
{
    global $ns, $dont_check_update, $e107info;
    $update_needed = FALSE;
    if ($dont_check_update === FALSE) {
        global $dbupdate, $dbupdatep, $e107cache;
        // See which core functions need update
        foreach ($dbupdate as $func => $rmks) {
            if (function_exists('update_' . $func)) {
                if (!call_user_func('update_' . $func, FALSE)) {
                    $update_needed = TRUE;
                    continue;
                }
            }
        }
        // Now check plugins
        foreach ($dbupdatep as $func => $rmks) {
            if (function_exists('update_' . $func)) {
                if (!call_user_func('update_' . $func, FALSE)) {
                    $update_needed = TRUE;
                    continue;
                }
            }
        }
        $e107cache->set_sys('nq_admin_updatecheck', time() . ',' . ($update_needed ? '2,' : '1,') . $e107info['e107_version'], TRUE);
    } else {
        $update_needed = $dont_check_update == '2';
    }
    if ($update_needed === TRUE) {
        require_once e_HANDLER . 'form_handler.php';
        $frm = new e_form();
        $txt = "\r\n\t\t<form method='post' action='" . e_ADMIN_ABS . "e107_update.php'>\r\n\t\t<div>\r\n\t\t\t" . ADLAN_120 . "\r\n\t\t\t" . $frm->admin_button('e107_system_update', LAN_UPDATE, 'update') . "\r\n\t\t</div>\r\n\t\t</form>\r\n\t\t";
        require_once e_HANDLER . 'message_handler.php';
        $emessage =& eMessage::getInstance();
        $emessage->add($txt);
    }
}