protected function __construct()
 {
     parent::__construct();
     $host = null;
     $port = null;
     $nc_core = nc_Core::get_object();
     $catalogue = $nc_core->catalogue->get_by_host_name($_SERVER['HTTP_HOST']);
     if ($catalogue) {
         $catalogueID = (int) $catalogue['Catalogue_ID'];
         $sql = "SELECT *, UNIX_TIMESTAMP(`Audit_Begin`) AS Audit_Begin " . "FROM `Cache_Settings` " . "WHERE `Catalogue_ID` = {$catalogueID}";
         $settings = $nc_core->db->get_row($sql, ARRAY_A);
         $host = $settings['Memcached_Host'];
         $port = $settings['Memcached_Port'];
     }
     $this->set_server($host, $port);
     // проверка наличия расширения
     if (!class_exists('Memcache')) {
         throw new Exception(NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED_DOESNT_EXIST);
     }
     $this->memcache = new Memcache();
     // соединение с сервером
     if (!@$this->memcache->connect($this->host, $this->port)) {
         throw new Exception(NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED_ERROR);
     }
 }
 /**
  * @access private
  */
 function render_value_field($html = true)
 {
     $nc_core = nc_Core::get_object();
     $ret = '';
     $textarea_id = $this->get_textarea_id();
     if ($this->embededitor) {
         $windowWidth = 750;
         $windowHeight = 605;
         switch (nc_Core::get_object()->get_settings('EditorType')) {
             default:
             case 2:
                 $editor_name = 'FCKeditor';
                 break;
             case 3:
                 $editor_name = 'ckeditor4';
                 $windowWidth = 1100;
                 $windowHeight = 420;
                 break;
             case 4:
                 $editor_name = 'tinymce';
                 break;
         }
         $link = "editors/{$editor_name}/neditor.php";
         $ret .= "<button type='button' onclick=\"window.open('" . $nc_core->SUB_FOLDER . $nc_core->HTTP_ROOT_PATH . $link . "?form=adminForm&control=" . $textarea_id . "', 'Editor', 'width={$windowWidth},height={$windowHeight},resizable=yes,scrollbars=no,toolbar=no,location=no,status=no,menubar=no');\">" . TOOLS_HTML_INFO . "</button><br />";
     }
     $value = $this->value ? $this->value : $this->default_value;
     $ret .= "<textarea id='" . $textarea_id . "' name='" . $this->get_field_name() . "' rows='" . $this->size . "' class='ncf_value_textarea" . ($this->codemirror ? "" : " no_cm") . "'>" . htmlspecialchars($value, ENT_QUOTES) . "</textarea>";
     if ($html) {
         $ret = "<div class='ncf_value'>" . $ret . "</div>\n";
     }
     return $ret;
 }
 public function set_value($value)
 {
     $nc_core = nc_Core::get_object();
     $this->value = false;
     if (preg_match("/(\\d+)\\-(\\d+)\\-(\\d+) (\\d*):(\\d*):(\\d*)/", $value, $match)) {
         $this->year = $match[1];
         $this->month = $match[2];
         $this->day = $match[3];
         $this->hours = $match[4];
         $this->minutes = $match[5];
         $this->seconds = $match[6];
     }
     $this->value['day'] = $this->day;
     $this->value['month'] = $this->month;
     $this->value['year'] = $this->year;
     $this->value['hours'] = $this->hours;
     $this->value['minutes'] = $this->minutes;
     $this->value['seconds'] = $this->seconds;
     if ($this->day) {
         $this->value['date'] = $this->day . "." . $this->month . "." . $this->year;
     }
     if ($this->hours) {
         $this->value['time'] = $this->hours . ":" . $this->minutes . ":" . $this->seconds;
     }
     $this->value['datetime'] = $this->value['date'] . " " . $this->value['time'];
     return 0;
 }
Exemple #4
0
 public function __construct()
 {
     // inherit
     parent::__construct();
     // get nc_core
     $this->core = nc_Core::get_object();
 }
Exemple #5
0
 /**
  * 
  * @return string
  */
 protected function get_index_path()
 {
     $path = $this->get_setting('ZendSearchLucene_IndexPath');
     $path = str_replace("%FILES%", nc_Core::get_object()->get_variable("FILES_FOLDER"), $path);
     $path = str_replace("//", "/", $path);
     return $path;
 }
Exemple #6
0
 /**
  * Class constructor method
  */
 public function __construct($url = null, $remove_sub_folder = true)
 {
     // load parent constructor
     parent::__construct();
     if (is_string($url)) {
         // Передана строка
         $this->url = $url;
     } else {
         // Использовать текущий запрошенный URL
         if ($url) {
             trigger_error("nc_url: URL must be a string, " . gettype($url) . "provided. Using REQUEST_URI as an URL", E_USER_WARNING);
         }
         $nc_core = nc_Core::get_object();
         $request_uri = urldecode($nc_core->REQUEST_URI);
         $url = "http" . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? "s" : "") . "://" . getenv("HTTP_HOST") . $request_uri;
         // надо сохранить get-параметры из окружения
         if (($start = strpos(getenv("REQUEST_URI"), '?')) !== false) {
             $env_query_string = substr(urldecode(getenv("REQUEST_URI")), $start + 1);
             $url_query_start = strpos($url, '?');
             if ($url_query_start !== false) {
                 $url = substr($url, 0, $url_query_start) . '?' . $env_query_string;
             } else {
                 $url .= '?' . $env_query_string;
             }
         }
         $this->url = $url;
     }
     $this->remove_sub_folder = $remove_sub_folder;
 }
Exemple #7
0
 /**
  *
  */
 public function __construct()
 {
     set_time_limit(0);
     ignore_user_abort(true);
     nc_Core::get_object()->db->query("SET wait_timeout=900");
     // might loose connection when running in slow mode
     nc_search::enable_error_logging();
 }
Exemple #8
0
 public function convert($ClassID, $action = 'convert')
 {
     $nc_core = nc_Core::get_object();
     $db = $nc_core->db;
     $fs = $action == 'convert' ? 1 : 0;
     if ($action == 'convert') {
         $this->db->query("UPDATE `Class` SET `File_Mode` = 1, `File_Path` = IF(`ClassTemplate` > 0, CONCAT('/', `ClassTemplate`, '/', `Class_ID`,'/'), CONCAT('/', `Class_ID`,'/')) WHERE `Class_ID` = " . $ClassID . " OR `ClassTemplate` = " . $ClassID);
     }
     if ($this->db->errno) {
         return nc_print_status(CONTROL_CLASS_CONVERT_DB_ERROR, 'error', null, 1);
     }
     $classes_data = $this->db->get_results("SELECT * FROM `Class` WHERE `Class_ID` = " . $ClassID . " OR `ClassTemplate` = " . $ClassID . " ORDER BY `ClassTemplate` ASC", ARRAY_A);
     foreach ($classes_data as $class_data) {
         $templates = $this->get_class_templates_list();
         //save tpls
         $class_editor = new nc_class_editor($nc_core->CLASS_TEMPLATE_FOLDER, $db);
         $class_editor->load($class_data['ClassTemplate']);
         $path = $class_editor->get_absolute_path() . $class_data['Class_ID'] . "/class_v40_backup.html";
         if ($action == 'convert') {
             $new_temlates = $this->convert_class_templates($class_data);
             $class_editor->save_new_class($class_data['Class_ID'], $new_temlates);
             foreach ($templates as $field_name => $tmp) {
                 $fields[$field_name] = "<!-- {$field_name} -->" . $class_data[$field_name] . "<!-- /{$field_name} -->";
             }
             $backup_content = join("\n\n", $fields);
             nc_save_file($path, $backup_content);
         } else {
             $restore_content = nc_check_file($path) ? nc_get_file($path) : false;
             if (!$restore_content) {
                 return nc_print_status(CONTROL_CLASS_CONVERT_UNDO_FILE_ERROR, 'error', null, 1);
             }
             foreach ($templates as $field_name => $tmp) {
                 if (preg_match("#<!-- ?{$field_name} ?-->(.*)<!-- ?/ ?{$field_name} ?-->#is", $restore_content, $matches)) {
                     $restored_templates[$field_name] = $matches[1];
                 }
             }
             if ($restored_templates && is_array($restored_templates)) {
                 $query = array();
                 foreach ($restored_templates as $field_name => $tmp) {
                     $query[] = "`" . $field_name . "` = '" . $db->prepare($tmp) . "'";
                 }
                 // сообственно, добавление
                 $SQL = "\nUPDATE `Class`";
                 $SQL .= "\n    SET `File_Mode` = 0 , " . join(",\n        ", $query);
                 $SQL .= "\n        WHERE `Class_ID` = " . $class_data['Class_ID'];
                 $this->db->query($SQL);
                 if ($this->db->errno) {
                     return nc_print_status(CONTROL_CLASS_CONVERT_DB_ERROR, 'error', null, 1);
                 }
             }
         }
         $message = nc_print_status(CONTROL_CLASS_CONVERT_OK, 'OK', null, 1);
         $message .= "<a href='index.php?phase=4&ClassID=" . $ClassID . "&fs=" . $fs . "'>" . CONTROL_CLASS_CONVERT_OK_GOEDIT . "</a>";
     }
     return $message;
     //no errors
 }
Exemple #9
0
function nc_htmleditor_save()
{
    $nc_core = nc_Core::get_object();
    $skin = $_POST['ck_skin'] ? $_POST['ck_skin'] : 'kama';
    $data = "<settings>\r\n\t<param name='ck_skin'>" . htmlspecialchars($skin) . "</param>\r\n</settings>";
    if (!@file_put_contents($nc_core->ROOT_FOLDER . "editors/nc_settings.xml", $data)) {
        print "error";
    }
}
Exemple #10
0
function AddSystemMessage($Message, $Description)
{
    global $db;
    $nc_core = nc_Core::get_object();
    if (!$nc_core->NC_UNICODE) {
        $Message = $nc_core->utf8->utf2win($Message);
    }
    $db->query("INSERT INTO `SystemMessage`\n\t\t(`Message`, `Description`)\n\t\tVALUES\n\t\t('" . $db->escape($Message) . "', '" . $db->escape($Description) . "')");
    return $db->insert_id;
}
Exemple #11
0
 /**
  *
  */
 public function __construct($view, $params)
 {
     $this->tabs = array(array('id' => 'info', 'caption' => NETCAT_MODULE_SEARCH_ADMIN_INFO, 'location' => "module.search.info"), array('id' => 'indexing', 'caption' => NETCAT_MODULE_SEARCH_ADMIN_INDEXING, 'location' => "module.search.indexing"), array('id' => 'lists', 'caption' => NETCAT_MODULE_SEARCH_ADMIN_LISTS, 'location' => "module.search.queries"), array('id' => 'settings', 'caption' => NETCAT_MODULE_SEARCH_ADMIN_SETTINGS, 'location' => "module.search.generalsettings"));
     $this->activeTab = $view;
     $this->locationHash = "module.search.{$view}" . ($params ? "({$params})" : "");
     $this->treeMode = "modules";
     $nc_core = nc_Core::get_object();
     $module_settings = $nc_core->modules->get_by_keyword('search');
     $this->treeSelectedNode = "module-{$module_settings['Module_ID']}";
 }
Exemple #12
0
 function ui_config_module_stats($view, $sub_view, $phase)
 {
     $this->tabs[] = array('id' => "openstat", 'caption' => NETCAT_MODULE_STATS_ADMIN_TAB_OPENSTAT, 'location' => "module.stats.openstat");
     $this->tabs[] = array('id' => "nc_stat", 'caption' => NETCAT_MODULE_STATS_ADMIN_TAB_NC_STAT, 'location' => "module.stats.nc_stat");
     $this->tabs[] = array('id' => "settings", 'caption' => STRUCTURE_TAB_SETTINGS, 'location' => "module.stats.settings");
     $this->activeTab = $view;
     $this->locationHash = "module.stats." . $view . ($sub_view ? "." . $sub_view : "") . ($phase ? "(" . $phase . ")" : "");
     $this->treeMode = "modules";
     $module_settings = nc_Core::get_object()->modules->get_by_keyword('stats');
     $this->treeSelectedNode = "module-" . $module_settings['Module_ID'];
 }
Exemple #13
0
/**
 * Выведем список системных таблиц
 */
function SystemTableList()
{
    global $db, $UI_CONFIG, $ADMIN_PATH;
    $nc_core = nc_Core::get_object();
    $nc_core->load('modules');
    $UI_CONFIG = new ui_config_system_classes('systemclass.list');
    // reinit old value from class/function.inc.php
    $UI_CONFIG->headerText = SECTION_SECTIONS_OPTIONS_SYSTEM;
    ?>
    <form method='post' action='index.php'>
        <table border='0' cellpadding='0' cellspacing='0' width='100%'>
        	<tr><td>
	            <table class='nc-table nc--striped nc--hovered' width='100%'>
    	            <tr>
        	    	    <th>ID</th>
            	        <th width='60%'><?php 
    echo CONTROL_SCLASS_TABLE;
    ?>
</th>
                        <th width='30%'><?php 
    echo CONTROL_SCLASS_ACTION;
    ?>
</th>
                        <th width='10%'><?php 
    echo CONTROL_CLASS_FIELDS;
    ?>
</th>
                    </tr>
<?php 
    $select = "SELECT a.System_Table_ID, a.System_Table_Rus_Name,b.Class_ID,IF(b.AddTemplate<>'' OR b.AddCond<>'' OR b.AddActionTemplate<>'',1,0) AS IsAdd, IF(b.EditTemplate<>'' OR b.EditCond<>'' OR b.EditActionTemplate<>'' OR b.CheckActionTemplate<>'' OR b.DeleteActionTemplate<>'',1,0) AS IsEdit, IF(b.SearchTemplate<>'' OR b.FullSearchTemplate<>'',1,0) AS IsSearch, IF(b.SubscribeTemplate<>'' OR b.SubscribeCond<>'',1,0) AS IsSubscribe, COUNT(f.Field_ID) AS `Fields`\n\t\tFROM System_Table AS a\n\t\tLEFT JOIN Class AS b ON a.System_Table_ID=b.System_Table_ID\tAND b.ClassTemplate = 0 AND b.File_Mode =" . +$_REQUEST['fs'] . "\n\t\tLEFT JOIN Field AS f ON f.System_Table_ID = a.System_Table_ID\n\t\tGROUP BY a.System_Table_ID\n\t\tORDER BY a.System_Table_ID";
    $Result = $db->get_results($select, ARRAY_N);
    foreach ($Result as $Array) {
        if ($Array[0] == 3) {
            //$Array[7] = $Array[7] / 2;
        } else {
            if (!+$_REQUEST['fs']) {
                continue;
            }
        }
        print "<tr>";
        print "<td>" . $Array[0] . "</td>";
        print "<td " . (!$Array[2] ? "colspan=2 " : "") . "bgcolor=white>" . ($Array[2] && $nc_core->modules->get_by_keyword('auth', 0) ? "<a href=" . $ADMIN_PATH . "field/system.php?fs=" . +$_REQUEST['fs'] . "&phase=2&SystemTableID=" . $Array[0] . ">" : "<a href=" . $ADMIN_PATH . "field/index.php?fs=" . +$_REQUEST['fs'] . "&isSys=1&amp;SystemTableID=" . $Array[0] . ">") . constant($Array[1]) . "</a></td>";
        if ($Array[2]) {
            print "<td>\n\t\t\t\t\t<a href=" . $ADMIN_PATH . "field/system.php?fs=" . +$_REQUEST['fs'] . "&phase=4&SystemTableID=" . $Array[0] . "&myaction=1>" . (!$Array[3] ? "<font color=gray>" : "") . CONTROL_CLASS_ACTIONS_ADD . "</a>&nbsp;&nbsp;\n\t\t\t\t\t<a href=" . $ADMIN_PATH . "field/system.php?fs=" . +$_REQUEST['fs'] . "&phase=4&SystemTableID=" . $Array[0] . "&myaction=2>" . (!$Array[4] ? "<font color=gray>" : "") . CONTROL_CLASS_ACTIONS_EDIT . "</a>&nbsp;&nbsp;\n\t\t\t\t\t<a href=" . $ADMIN_PATH . "field/system.php?fs=" . +$_REQUEST['fs'] . "&phase=4&SystemTableID=" . $Array[0] . "&myaction=3>" . (!$Array[5] ? "<font color=gray>" : "") . CONTROL_CLASS_ACTIONS_SEARCH . "</a></td>";
        }
        print "<td><a class=\"nc-label nc--blue\" href=\"" . $ADMIN_PATH . "field/index.php?fs=" . +$_REQUEST['fs'] . "&isSys=1&amp;SystemTableID=" . $Array[0] . "&fs=" . +$_REQUEST['fs'] . "\">" . $Array[7] . " " . mb_strtolower(plural_form($Array[7], CONTROL_CLASS_FIELD, CONTROL_CLASS_FIELDS, CONTROL_CLASS_FIELDS_COUNT)) . "</a></td>\n";
        print "</tr>";
    }
    ?>
				</table>
			</td></tr>
		</table>
<?php 
}
Exemple #14
0
 public function get_urls()
 {
     $res = array();
     $site_settings = nc_Core::get_object()->catalogue->get_all();
     foreach ($site_settings as $s) {
         if ($s["Domain"]) {
             $res[] = "http://{$s['Domain']}/";
         }
     }
     return $res;
 }
Exemple #15
0
 public function get_description()
 {
     $site_id = $this->get_id();
     $link = "{$GLOBALS['ADMIN_PATH']}#site.map({$site_id})";
     try {
         $name = nc_Core::get_object()->catalogue->get_by_id($site_id, "Catalogue_Name");
     } catch (Exception $e) {
         $name = "site{$site_id}";
     }
     return sprintf(NETCAT_MODULE_SEARCH_ADMIN_RULE_AREA_DESCRIPTION_SITE, $link, $name);
 }
Exemple #16
0
 public function create_dir($fullpath)
 {
     $nc_core = nc_Core::get_object();
     if (is_dir($fullpath)) {
         return true;
     }
     if ($res = mkdir($fullpath, $nc_core->DIRCHMOD, 1)) {
         chmod($fullpath, $nc_core->DIRCHMOD);
     }
     return $res;
 }
Exemple #17
0
function getCompletionDataForTemplateFields($systemTableID)
{
    $fields = (array) nc_Core::get_object()->db->get_results("SELECT Field_ID, Field_Name, Description FROM Field WHERE System_Table_ID=" . intval($systemTableID), ARRAY_A);
    $result = array();
    if (!$fields) {
        return '';
    }
    foreach ($fields as $f) {
        $result[] = array('completion' => array('name' => $f['Field_Name'], 'value' => $f['Field_Name'], 'help' => $f['Description'] . '.'), 'type' => 'macros', 'areas' => array('TemplateForm'));
    }
    return $result;
}
Exemple #18
0
 public function __construct()
 {
     parent::__construct();
     $this->core = nc_Core::get_object();
     $this->widgetclasses = array();
     $this->widgetclasses_keys = array();
     $this->widgetclasses_loaded = false;
     $this->widgets = array();
     $this->widgets_keys = array();
     $this->widgets_loaded = false;
     $this->core->register_macrofunc('NC_WIDGET_SHOW', 'show_macrofunc', $this);
 }
Exemple #19
0
function nc_format_typo($text)
{
    $nc_core = nc_Core::get_object();
    if (!$nc_core->NC_UNICODE) {
        $text = $nc_core->utf8->win2utf($text);
    }
    $text = nc_typo($text, array('cleen_utf' => true));
    if (!$nc_core->NC_UNICODE) {
        $text = $nc_core->utf8->utf2win($text);
    }
    return $text;
}
function LoginFormHeader()
{
    global $ADMIN_FOLDER, $ADMIN_TEMPLATE;
    $nc_core = nc_Core::get_object();
    $lang = $nc_core->lang->detect_lang();
    require_once $ADMIN_FOLDER . "lang/" . $lang . ".php";
    ?>
<!DOCTYPE html>
<!--[if lt IE 7]><html class="nc-ie6 nc-oldie"><![endif]-->
<!--[if IE 7]><html class="nc-ie7 nc-oldie"><![endif]-->
<!--[if IE 8]><html class="nc-ie8 nc-oldie"><![endif]-->
<!--[if gt IE 8]><!--><html><!--<![endif]-->
  <head>
  <meta http-equiv='content-type' content='text/html; charset=<?php 
    echo $nc_core->NC_CHARSET;
    ?>
'/>
  <link type='text/css' rel='Stylesheet' href='<?php 
    echo $nc_core->ADMIN_TEMPLATE;
    ?>
css/login.css'>
  <link type='text/css' rel='Stylesheet' href='<?php 
    echo $nc_core->ADMIN_TEMPLATE;
    ?>
css/style.css'>
  <?php 
    echo nc_js();
    ?>
  <title><?php 
    echo CONTROL_AUTH_HTML_CMS . " NetCat";
    ?>
</title>
  </head>
  <body class="nc-admin">
  	<div class='login_wrap'>
    <div class='top_line'>
        <div class='logo'><a href='#'><img src='<?php 
    echo $nc_core->ADMIN_TEMPLATE;
    ?>
img/logo.png' alt='NetCat <?php 
    echo BEGINHTML_VERSION . " " . $VERSION_ID . " " . $SYSTEM_NAME;
    ?>
' /></a></div>
        <div class='top_text'><?php 
    echo CONTROL_AUTH_HTML_CMS;
    ?>
 <a href="http://www.netcat.ru">NetCat</a></div>
    </div>
    <div class='content' align='center'>
	<?php 
}
 public function __construct(nc_multifield $multifield)
 {
     $this->multifield = $multifield;
     if (self::$dnd === null) {
         $nc_core = nc_Core::get_object();
         /*self::$dnd = "<script>
           if (typeof(jQuery) == 'undefined') {
               document.write(\"<scr\" + \"ipt type='text/javascript' src='{$nc_core->NC_JQUERY_PATH}'></scr\" + \"ipt>\");
           }
           </script>";*/
         #self::$dnd .= "<script type='text/javascript' src='" . $nc_core->SUB_FOLDER . $nc_core->HTTP_TEMPLATE_PATH . "jquery/tablednd.min.js'></script>";
         self::$dnd .= "<style> .DTDClass { background-color: #EEE; } .DTD { cursor: move; } </style>";
     }
 }
Exemple #22
0
 public function settings()
 {
     $nc_core = nc_Core::get_object();
     $Catalogue_ID = (int) $this->POST['Catalogue_ID'];
     $catalogues = $this->db->get_results("SELECT `Catalogue_ID`, `Catalogue_Name` FROM `Catalogue` ORDER BY `Priority`", ARRAY_A);
     if (empty($catalogues)) {
         // no data
         nc_print_status(CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_NONE, 'info');
         // return
         return false;
     }
     if (!$Catalogue_ID) {
         $Catalogue_ID = $catalogues[0]['Catalogue_ID'];
     }
     $memcached_enabled = class_exists('Memcache');
     $settings = $this->db->get_row("SELECT *, UNIX_TIMESTAMP(`Audit_Begin`) AS Audit_Begin\n      FROM `Cache_Settings` WHERE `Catalogue_ID` = '" . $Catalogue_ID . "'", ARRAY_A);
     echo "<form method='post' action='admin.php' style='padding:0; margin:0;'>\n" . "<fieldset>\n" . "<legend>\n" . "" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_CATALOGUE . "\n" . "</legend>\n" . "<div style='margin:10px 0; _padding:0;'>\n" . "<select name='Catalogue_ID' onchange='this.form.submit();' style='width:50%'>\n";
     foreach ($catalogues as $value) {
         echo "<option value='" . $value['Catalogue_ID'] . "' " . ($value['Catalogue_ID'] == $Catalogue_ID ? "selected" : "") . ">" . $value['Catalogue_ID'] . ": " . $value['Catalogue_Name'] . "</option>\n";
     }
     echo "</select>\n" . "</div>\n" . "</fieldset>\n" . "</form>\n";
     echo "<form method='post' action='admin.php' id='SetCacheMainSettings' style='padding:0; margin:0;'>\n" . "<fieldset>\n" . "<legend>\n" . "" . NETCAT_MODULE_CACHE_ADMIN_MAINSETTINGS_TITLE . "\n" . "</legend>\n" . "<div style='margin:10px 0; _padding:0;'>\n" . "<table class='admin_table' style='width:50%; ; border:none;'>\n" . "<col style='width:60%'/><col style='width:20%'/><col style='width:20%'/>\n" . "<tr>\n" . "<td>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_CACHE_TYPE . "</td>\n" . "<td style='; text-align:center'>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_CACHE_OFF . "</td>\n" . "<td style='; text-align:center'>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_CACHE_ON . "</td>\n" . "</tr>\n";
     foreach ($this->cache_essence as $key => $value) {
         echo "<tr>\n" . "<td>" . $value[1] . "</td>\n" . "<td style='; text-align:center'><input type='radio' name='Status_" . $key . "' value='0'" . ($settings['Status_' . $key] == 0 ? " checked" : "") . "></td>\n" . "<td style='; text-align:center'><input type='radio' name='Status_" . $key . "' value='1'" . ($settings['Status_' . $key] == 1 ? " checked" : "") . "></td>\n" . "</tr>\n";
     }
     echo "</table>\n" . "</div>\n" . "</fieldset>\n";
     // memcached
     echo "<fieldset>\n" . "<legend>\n" . "" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED . "\n" . "</legend>\n" . "<div style='margin:10px 0; padding:0;'>\n" . ($memcached_enabled ? "" : NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED_DOESNT_EXIST . "<br/><br/>") . "<input type='checkbox' name='MemcacheEnabled'" . ($settings['IO_Interface'] == 'memcache' ? " checked" : "") . " " . ($memcached_enabled ? "" : "disabled") . "> " . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED_ON . "<br/><br/>\n" . "</div>\n" . "<div style='margin:10px 0; _padding:0;'>\n" . "<table  class='admin_table' style='width:100%; ; border:none;'>\n" . "<col style='width:35%'/><col style='width:65%'/>\n" . "<tr>\n" . "<td>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED_HOST . "</td>\n" . "<td><input type='text' name='Memcached_Host' style='width:100%' value='" . ($settings['Memcached_Host'] ? $settings['Memcached_Host'] : "localhost") . "' /></td>\n" . "</tr>\n" . "<tr>\n" . "<td>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_MEMCACHED_PORT . "</td>\n" . "<td><input type='text' name='Memcached_Port' style='width:100%' value='" . ($settings['Memcached_Port'] ? $settings['Memcached_Port'] : "0") . "' /></td>\n" . "</tr>\n" . "</table>\n" . "</div>\n" . "</fieldset>\n";
     // main settings block
     echo "<input type='hidden' name='Catalogue_ID' value='" . $Catalogue_ID . "'>\n" . "<fieldset>\n" . "<legend>\n" . "" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_AUDIT . "\n" . "</legend>\n";
     $AuditEnd = strtotime("+" . $settings['Audit_Time'] . " hours", $settings['Audit_Begin']);
     echo "<div style='margin:10px 0; _padding:0;'>\n" . "<input type='checkbox' name='CacheAuditMode'" . ($AuditEnd > time() ? " checked" : "") . "> " . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_AUDIT_ON . "<br/><br/>\n" . "</div>\n" . "<div style='margin:10px 0; _padding:0;'>\n" . "<table class='admin_table' style='width:100%; ; border:none;'>\n" . "<col style='width:35%'/><col style='width:35%'/><col style='width:30%'/>\n" . "<tr>\n" . "<td>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_AUDIT_BEGIN . "</td>\n" . "<td>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_AUDIT_END . "</td>\n" . "<td>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_AUDIT_TIME . "</td>\n" . "</tr>\n" . "<tr>\n" . "<td>" . ($settings['Audit_Begin'] && $AuditEnd > time() ? date("d-m-Y H:i:s", $settings['Audit_Begin']) : NETCAT_MODULE_CACHE_ADMIN_SETTINGS_AUDIT_SAVE_TIME) . "</td>\n" . "<td>" . ($settings['Audit_Begin'] && $AuditEnd > time() ? date("d-m-Y H:i:s", $AuditEnd) : NETCAT_MODULE_CACHE_ADMIN_AUDIT_NODATA) . "</td>\n" . "<td><input type='text' name='Audit_Time' style='width:100%' value='" . (int) $settings['Audit_Time'] . "'></td>\n" . "</table>\n" . "</div>\n" . "</fieldset>\n";
     // quota settings block
     echo "<fieldset>\n" . "<legend>\n" . "" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_QUOTA_TITLE . "\n" . "</legend>\n" . "<div style='margin:10px 0; _padding:0;'>\n" . "<table class='admin_table' style='width:100%; ; border:none;'>\n" . "<col style='width:25%'/><col style='width:30%'/><col style='width:20%'/><col style='width:20%'/><col style='width:5%'/>\n" . "<tr>\n" . "<td rowspan='2'>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_QUOTA_MAXSIZE_HEADER_CACHE . "</td>\n" . "<td rowspan='2'>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_QUOTA_MAXSIZE_HEADER_SIZE . "</td>\n" . "<td style='; text-align:center' colspan='2'>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_QUOTA_OVERDRAFT . "</td>\n" . "<td style='; text-align:center;' rowspan='2'><div class='icons icon_delete' title='" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_QUOTA_MAXSIZE_HEADER_CLEAR . "'></div></td>\n" . "</tr>\n" . "<tr>\n" . "<td style='; text-align:center'>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_QUOTA_OVERDRAFT_NOCACHE . "</td>\n" . "<td style='; text-align:center'>" . NETCAT_MODULE_CACHE_ADMIN_SETTINGS_QUOTA_OVERDRAFT_DROP . "</td>" . "</tr>";
     $cache_clear = $this->db->get_results("SELECT `Essence`, COUNT(`ID`) AS rows FROM `Cache_Clear` GROUP BY `Essence`", ARRAY_A);
     if (!empty($cache_clear)) {
         $cache_clear_data = array();
         foreach ($cache_clear as $value) {
             $cache_clear_data[$value['Essence']] = $value['rows'];
         }
     }
     foreach ($this->cache_essence as $key => $value) {
         echo "<tr>\n" . "<td>" . $value[1] . "</td>\n" . "<td><input type='text' name='Quota_" . $key . "' style='width:100%' value='" . (int) $settings['Quota_' . $key] . "'></td>\n" . "<td style='; text-align:center'><input type='radio' name='Overdraft_" . $key . "' value='1'" . ($settings['Overdraft_' . $key] == 1 || !$cache_clear_data[$key] ? " checked" : (!$settings['Overdraft_' . $key] ? " checked" : "")) . "></td>\n" . "<td style='; text-align:center'><input type='radio' name='Overdraft_" . $key . "' value='2'" . ($settings['Overdraft_' . $key] == 2 && $cache_clear_data[$key] ? " checked" : "") . "" . ($cache_clear_data[$key] ? "" : " disabled") . "></td>\n" . "<td style='; text-align:center;'><input type='checkbox' name='CacheClear_" . $key . "' value='1'></td>\n" . "</tr>\n";
     }
     echo "</table>\n" . "</div>\n\n";
     // admin buttons
     $this->UI_CONFIG->actionButtons[] = array("id" => "submit", "caption" => NETCAT_MODULE_CACHE_ADMIN_MAINSETTINGS_SAVE_BUTTON, "action" => "mainView.submitIframeForm('SetCacheMainSettings')");
     echo "<input type='hidden' name='phase' value='2'>\n" . "</fieldset>\n" . $nc_core->token->get_input() . "</form>\n";
     return;
 }
Exemple #23
0
 /**
  * Constructor function
  */
 public function __construct()
 {
     // load parent constructor
     parent::__construct();
     // system superior object
     $this->core = nc_Core::get_object();
     $this->db = $this->core->db;
     $this->deleted_ids = array();
     $this->trash_full = 0;
     $this->folder_fail = 0;
     $this->max_file_size = 10 * 1024 * 1024;
     if (!class_exists('DOMDocument')) {
         $this->db->query("UPDATE `Settings` SET `Value` = '0' WHERE `Key` = 'TrashUse'");
     }
 }
Exemple #24
0
 public function utf2win($str)
 {
     // system superior object
     $nc_core = nc_Core::get_object();
     if (extension_loaded("mbstring")) {
         return mb_convert_encoding($str, "cp1251", "UTF-8");
     }
     if (extension_loaded("iconv")) {
         return iconv("UTF-8", "cp1251", $str);
     }
     if (!$this->UTFConverter) {
         require_once $nc_core->get_variable("INCLUDE_FOLDER") . "lib/utf8/utf8.class.php";
         $this->UTFConverter = new utf8(CP1251);
     }
     return $this->UTFConverter->utf8ToStr($str);
 }
Exemple #25
0
 public function CreateHtml($textarea_id)
 {
     $nc_core = nc_Core::get_object();
     $ed_path = $nc_core->SUB_FOLDER . $nc_core->HTTP_ROOT_PATH . 'editors/nc_UserEditor/';
     $js_path = $ed_path . 'nc_UserEditor.js';
     $smile_path = $nc_core->SUB_FOLDER . "/images/smiles/";
     $value = htmlspecialchars($this->Value);
     $value = nc_bbcode($value);
     $value = str_replace(array("\r\n", "\r", "\n"), "\" +  \"<br />\" + \"", $value);
     $lang = $nc_core->lang->detect_lang(1);
     if ($lang == 'ru') {
         $lang = $nc_core->NC_UNICODE ? "ru_utf8" : "ru_cp1251";
     }
     $Html = "<script type='text/javascript' src='" . $ed_path . "lang/" . $lang . ".js'></script>\n\n             <script type='text/javascript' src='" . $js_path . "'></script>\n\n             <script type='text/javascript'>bkLib.onDomLoaded(function(){nicEditors.allTextAreas('" . $textarea_id . "', \"" . $value . "\", '" . $ed_path . "', '" . $smile_path . "')});</script>\n";
     return $Html;
 }
Exemple #26
0
 /**
  *
  */
 public function save($option, $value)
 {
     $this->set($option, $value);
     if (isset($this->file_templates[$option])) {
         // templates
         if (!$this->module_editor) {
             $this->module_editor = new nc_module_editor();
             $this->module_editor->load('search');
         }
         $this->module_editor->save(array($option => $value));
     } else {
         // other settings
         nc_Core::get_object()->set_settings($option, $value, 'search');
     }
     return $this;
 }
Exemple #27
0
 /**
  * Return netcat database object
  *
  * @return bool
  */
 private function _getNetcatDb()
 {
     if (!$this->_db) {
         require_once $this->coreCmsPath . 'vars.inc.php';
         require_once $this->coreCmsPath . 'netcat/system/nc_system.class.php';
         require_once $this->coreCmsPath . 'netcat/system/nc_db.class.php';
         require_once $this->coreCmsPath . 'netcat/system/nc_core.class.php';
         $core = \nc_Core::get_object();
         $core->MYSQL_USER = $MYSQL_USER;
         $core->MYSQL_PASSWORD = $MYSQL_PASSWORD;
         $core->MYSQL_DB_NAME = $MYSQL_DB_NAME;
         $core->MYSQL_HOST = $MYSQL_HOST;
         $core->MYSQL_CHARSET = $MYSQL_CHARSET;
         $this->_db = new \nc_Db();
     }
     return $this->_db;
 }
Exemple #28
0
 /**
  *
  */
 public function __construct()
 {
     $this->start_time = time();
     $this->time_threshold = $this->get_time_threshold();
     if (self::$original_time_limit === null) {
         self::$original_time_limit = ini_get('max_execution_time');
     }
     $this->time_limit = self::$original_time_limit;
     $this->memory_threshold = $this->get_memory_threshold();
     $this->memory_limit = nc_search_util::int_from_bytes_string(ini_get('memory_limit'));
     $this->delay = nc_search::get_setting('CrawlerDelay');
     $this->cycle_limit = $this->get_max_cycles_number();
     @set_time_limit(0);
     nc_search::enable_error_logging();
     ignore_user_abort(true);
     nc_Core::get_object()->db->query("SET wait_timeout=900");
     // might loose connection when running in slow mode
 }
 public function load_template($id, $relative_path = null, $is_preview = false)
 {
     $this->template->load($id, 'Template', $relative_path);
     $this->is_preview = $is_preview;
     $core_template = nc_Core::get_object()->template;
     $all_id = explode('/', trim($this->template->relative_path, '/'));
     $this->root_template_id = current($all_id);
     foreach ($all_id as $id) {
         if (!+$id) {
             continue;
         }
         $hash = $core_template->get_by_id($id, 'File_Hash');
         if ($hash) {
             $template = new nc_tpl($this->template->path_to_root_folder, $this->template->db);
             $template->load($id, 'Template', $core_template->get_by_id($id, 'File_Path'));
             nc_tpl_parser::main2parts($template, $hash);
         }
     }
 }
Exemple #30
0
 public function __construct()
 {
     require_once 'HTTP/Client.php';
     // /netcat/require/lib
     require_once 'HTTP/Request/Listener.php';
     $headers = array('User-Agent' => nc_search::get_setting('CrawlerUserAgent'));
     $this->http_client = new HTTP_Client(null, $headers);
     $this->http_client->enableHistory(false);
     $this->http_client->setMaxRedirects(nc_search::get_setting('CrawlerMaxRedirects'));
     $max_doc_size = nc_search::get_setting('CrawlerMaxDocumentSize');
     $db = nc_Core::get_object()->db;
     $accepted_mime_types = $db->get_col("SELECT DISTINCT `ContentType`\n                                               FROM `Search_Extension`\n                                              WHERE `ExtensionInterface` = 'nc_search_document_parser'");
     //        $accepted_mime_types = nc_search::load_all('nc_search_extension_rule')
     //                        ->where('extension_interface', 'nc_search_document_parser')
     //                        ->each('get', 'content_type');
     //        $accepted_mime_types = array_unique($accepted_mime_types);
     $listener = new nc_search_indexer_crawler_listener($max_doc_size, $accepted_mime_types);
     $this->http_client->attach($listener, true);
 }