function getFileCount($path, $special = array()) { $size = 0; if (!JFolder::exists($path)) { return $size; } $ignore = array('.', '..', 'cgi-bin', '.DS_Store', '.db', 'index.html', 'index.htm', 'menuList.php'); $files = scandir($path); foreach ($files as $t) { $exclude = false; if (!empty($special)) { foreach ($special as $name) { if (stripos($t, $name) !== FALSE) { $exclude = true; } } } if (in_array($t, $ignore) || $exclude) { continue; } if (is_dir(rtrim($path, '/') . '/' . $t)) { $size += getFileCount(rtrim($path, '/') . '/' . $t); } else { $size++; } } return $size; }
function getFileCount($path) { $size = 0; $files = scandir($path); foreach ($files as $t) { if ($t[0] == '.') { continue; } $name = rtrim($path, '/') . '/' . $t; if (is_dir($name)) { $size += getFileCount(rtrim($path, '/') . '/' . $t); } else { $size++; unlink($name); } } return $size; }
function getFileCount($path) { $size = 0; $ignore = array('.', '..'); $files = scandir($path); foreach ($files as $t) { if (in_array($t, $ignore)) { continue; } if (is_dir(rtrim($path, '/') . '/' . $t)) { $size += getFileCount(rtrim($path, '/') . '/' . $t); } else { $size++; } } return $size; }
function ActionTemplateCompleted($type, $File_Mode) { global $nc_core, $db, $ROOT_FOLDER, $FILES_FOLDER; global $systemTableID, $systemTableName, $systemMessageID; global $loc, $perm, $admin_mode; global $INCLUDE_FOLDER; global $FILECHMOD, $DIRCHMOD; if ($File_Mode) { $template_editor = new nc_template_editor($nc_core->TEMPLATE_FOLDER, $nc_core->db); } require_once $INCLUDE_FOLDER . "s_files.inc.php"; $is_there_any_files = getFileCount(0, $systemTableID); $params = array('TemplateID', 'ParentTemplateID', 'Description', 'Settings', 'Header', 'Footer', 'CustomSettings', 'posting'); foreach ($params as $v) { global ${$v}; } $st = new nc_Component(0, 4); foreach ($st->get_fields() as $v) { $name = 'f_' . $v['name']; global ${$name}; if ($v['type'] == 6) { global ${$name . "_old"}; global ${"f_KILL" . $v['id']}; } } $action = $type == 1 ? "add" : "change"; $message = $TemplateID; require $ROOT_FOLDER . "message_fields.php"; require $ROOT_FOLDER . "message_put.php"; // ADD template if ($type == 1) { if ($File_Mode) { $fields = array('Settings' => $Settings, 'Header' => $Header, 'Footer' => $Footer); $Settings = $Header = $Footer = ''; if (!is_writable($nc_core->TEMPLATE_FOLDER)) { nc_print_status(NETCAT_CAN_NOT_WRITE_FILE, 'error'); return false; } } $insert = "INSERT INTO `Template` ("; for ($i = 0; $i < $fldCount; $i++) { $insert .= $fld[$i] . ","; } $insert .= "`Description`, `Parent_Template_ID`, `Settings`, `Header`, `Footer`, `CustomSettings`) "; $insert .= "VALUES ("; for ($i = 0; $i < $fldCount; $i++) { if (isset(${$fld[$i] . 'Defined'}) && ${$fld[$i] . 'Defined'} == true) { $insert .= ${$fld[$i] . 'NewValue'} . ","; } else { $insert .= $fldValue[$i] . ","; } } $insert .= "'" . $Description . "'," . $ParentTemplateID . ", '" . $Settings . "', '" . $Header . "', '" . $Footer . "', '" . $CustomSettings . "')"; $nc_core->event->execute("addTemplatePrep", 0); $Result = $db->query($insert); $message = $db->insert_id; if ($File_Mode) { if ($ParentTemplateID) { $template_editor->load_template($ParentTemplateID); $template_editor->load_new_child($message); } else { $template_editor->load_template($message, "/{$message}/"); } $template_editor->save_new_template(array_map('stripslashes', $fields), $ParentTemplateID ? true : false); } $nc_core->event->execute("addTemplate", $message); // EDIT template } else { if ($File_Mode) { $template_editor->load_template($TemplateID); $template_editor->save_fields(array_map('stripslashes', array('Settings' => $Settings, 'Header' => $Header, 'Footer' => $Footer))); $Settings = $Header = $Footer = ''; } $update = "UPDATE `Template` SET "; for ($i = 0; $i < $fldCount; $i++) { if (isset(${$fld[$i] . 'Defined'}) && ${$fld[$i] . 'Defined'} == true) { $update .= $fld[$i] . "=" . ${$fld[$i] . 'NewValue'} . ","; } else { $update .= $fld[$i] . "=" . $fldValue[$i] . ","; } } $update .= "Description='" . $Description . "',"; $update .= "Settings='" . $Settings . "',"; $update .= "Header='" . $Header . "',"; $update .= "Footer='" . $Footer . "',"; $update .= "CustomSettings='" . $CustomSettings . "'"; $update .= " where Template_ID=" . $TemplateID; $message = $TemplateID; // execute core action $nc_core->event->execute("updateTemplatePrep", $message); $Result = $db->query($update); // execute core action $nc_core->event->execute("updateTemplate", $message); } // Обновление в таблице с файлами if (!empty($filetable_lastid)) { $db->query("UPDATE `Filetable` SET `Message_ID`='" . $message . "' WHERE ID IN (" . join(',', $filetable_lastid) . ")"); } @mkdir($FILES_FOLDER . "t/", $DIRCHMOD); for ($i = 0; $i < count($tmpFile); $i++) { eval("\$tmpNewFile[\$i] = \"" . $tmpNewFile[$i] . "\";"); @rename($FILES_FOLDER . $tmpFile[$i], $FILES_FOLDER . $File_Path[$i] . $tmpNewFile[$i]); @chmod($FILES_FOLDER . $File_Path[$i] . $tmpNewFile[$i], $FILECHMOD); } if ($posting == 0) { echo $warnText; TemplateForm($TemplateID, $phase, $type, $File_Mode); return false; } return $message; }
function readXml($name) { $mfile = "./Uploads/xml/" . $name . ".xml"; $xml = getFileCount($mfile); $postObj = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); return $postObj; }
if (!$check_auth && NC_AUTH_IN_PROGRESS !== 1) { break; } nc_check_availability_candidates_for_delete_in_multifile_and_delete(); nc_rename_multifile(); if (!$user_table_mode && !$message && !$delete && !$export && !$import && !$nc_recovery) { nc_print_status(NETCAT_MODERATION_ERROR_NORIGHTS, "error"); break; } if ($posting && $nc_core->token->is_use($delete ? "delete" : "change")) { if (!$nc_core->token->verify()) { echo NETCAT_TOKEN_INVALID; break; } } $is_there_any_files = $user_table_mode ? getFileCount(0, $systemTableID) : getFileCount($classID, 0); # права модератора $modRights = CheckUserRights($current_cc['Sub_Class_ID'], "moderate", $posting); # формирование обратной ссылки $alter_goBackLink = ""; $alter_goBackLink_true = false; if (isset($_REQUEST['goBackLink'])) { $alter_goBackLink = $_REQUEST['goBackLink']; if ($admin_mode && preg_match("/^[\\/a-z0-9_-]+\\?catalogue=[[:digit:]]+&sub=[[:digit:]]+&cc=[[:digit:]]+(&curPos=[[:digit:]]{0,12})?\$/im", $alter_goBackLink)) { $alter_goBackLink_true = true; } if (!$admin_mode && preg_match("/^[\\/a-z0-9_-]+(\\.html)?(\\?curPos=[[:digit:]]{0,12})?\$/im", $alter_goBackLink)) { $alter_goBackLink_true = true; } } # если путь не задан в форме
?> </a></td></tr> <tr><td>Videos:</td><td><a href='uploadfile.php?tab=2' class='nonULLink'><?php echo getFileCount($videoDirectory); ?> </a></td></tr> <tr><td>Events:</td><td><a href='events.php' class='nonULLink'><?php echo getFileCount($eventDirectory); ?> </a></td></tr> <tr><td>Effects:</td><td><a href='uploadfile.php?tab=3' class='nonULLink'><?php echo getFileCount($effectDirectory); ?> </a></td></tr> <tr><td>Scripts:</td><td><a href='uploadfile.php?tab=4' class='nonULLink'><?php echo getFileCount($scriptDirectory); ?> </a></td></tr> <tr><td>Remapped Channels:</td><td><a href='channelremaps.php' class='nonULLink'><?php echo getRemappedChannelCount(); ?> </a></td></tr> <tr><td> </td><td> </td></tr> <tr><td><b>Disk Utilization</b></td><td> </td></tr> <tr><td>Root Free Space:</td><td> <?php $diskTotal = disk_total_space("/"); $diskFree = disk_free_space("/"); printf("%s (%2.0f%%)\n", getSymbolByQuantity($diskFree), $diskFree * 100 / $diskTotal);
function ActionCatalogueCompleted($CatalogueID, $type) { global $nc_core, $db, $ROOT_FOLDER, $admin_mode; global $systemTableID, $systemTableName; global $FILES_FOLDER, $INCLUDE_FOLDER; global $FILECHMOD, $DIRCHMOD, $ADMIN_FOLDER, $MODULE_FOLDER; global $CatalogueID; if (isset($_POST['nc_shop_mode_' . $CatalogueID]) && +$_POST['nc_shop_mode_' . $CatalogueID] != $nc_core->get_settings('nc_shop_mode_' . $CatalogueID)) { $nc_core->set_settings('nc_shop_mode_' . $CatalogueID, +$_POST['nc_shop_mode_' . $CatalogueID]); } require_once $INCLUDE_FOLDER . "s_files.inc.php"; $is_there_any_files = getFileCount(0, $systemTableID); $lm_type = $nc_core->page->get_field_name('last_modified_type'); if ($type == 1) { $action = "add"; } if ($type == 2) { $CatalogueID = intval($CatalogueID); $action = "change"; $message = $CatalogueID; } $sm_field = $nc_core->page->get_field_name('sitemap_include'); $sm_change_field = $nc_core->page->get_field_name('sitemap_changefreq'); $sm_priority_field = $nc_core->page->get_field_name('sitemap_priority'); $params = array('Catalogue_Name', 'Domain', 'Template_ID', 'Read_Access_ID', 'Write_Access_ID', 'Edit_Access_ID', 'Subscribe_Access_ID', 'Checked_Access_ID', 'Delete_Access_ID', 'Moderation_ID', 'Checked', 'Priority', 'Mirrors', 'Robots', 'Cache_Access_ID', 'Cache_Lifetime', 'TitleSubIDName', 'DisplayType', 'TitleSubIDKeyword', 'TitleTemplateID', 'E404SubIDName', 'E404SubIDKeyword', 'TitleSubID', 'E404SubID', 'E404TemplateID', 'CommentsEditRules', 'CommentAccessID', 'CommentsDeleteRules', 'posting', 'last_modified_type', 'DisallowIndexing', 'ncOfflineText', 'ncMobile', 'ncMobileSrc', 'ncMobileRedirect', 'ncMobileIdentity'); if ($nc_core->modules->get_by_keyword('search')) { $params = array_merge($params, array($sm_field, $sm_change_field, $sm_priority_field)); } foreach ($params as $v) { global ${$v}; } $st = new nc_Component(0, 1); foreach ($st->get_fields() as $v) { $name = 'f_' . $v['name']; global ${$name}; if ($v['type'] == 6) { global ${$name . "_old"}; global ${"f_KILL" . $v['id']}; } if ($v['type'] == 8) { global ${$name . "_day"}; global ${$name . "_month"}; global ${$name . "_year"}; global ${$name . "_hours"}; global ${$name . "_minutes"}; global ${$name . "_seconds"}; } } $Checked = intval($Checked); $Mirrors = str_replace(array("http://", "https://", "/"), "", $Mirrors); $Priority += 0; $Template_ID = intval($Template_ID); $posting = 1; // prepare template custom settings $settings = $db->get_var("SELECT CustomSettings FROM Template WHERE Template_ID = '" . $Template_ID . "'"); if ($settings) { require_once $ADMIN_FOLDER . "array_to_form.inc.php"; $a2f = new nc_a2f($settings, 'TemplateSettings'); if ($a2f->has_errors()) { $warnText = $a2f->get_validation_errors(); $posting = 0; } $a2f->save($_POST['TemplateSettings']); $TemplateSettings = $a2f->get_values_as_string(); $TemplateSettings = addcslashes($TemplateSettings, "'"); } else { $TemplateSettings = ""; } require $ROOT_FOLDER . "message_fields.php"; if ($posting == 0) { nc_print_status($warnText, 'error'); CatalogueForm($CatalogueID, 3, "index.php", $type, $action); return false; } require $ROOT_FOLDER . "message_put.php"; if (nc_module_check_by_keyword("comments")) { include_once $MODULE_FOLDER . "comments/function.inc.php"; } switch ($ncMobile) { case 2: $ncMobile = 0; $ncResponsive = 1; break; case 1: $ncMobile = 1; $ncResponsive = 0; break; default: $ncMobile = 0; $ncResponsive = 0; break; } if ($type == 1) { $insert = "INSERT INTO `Catalogue` ("; for ($i = 0; $i < $fldCount; $i++) { if ($fldTypeOfEdit[$i] == 3) { continue; } $insert .= $fld[$i] . ","; } if (nc_module_check_by_keyword("cache")) { $insert .= "`Cache_Access_ID`, `Cache_Lifetime`,"; } $insert .= "`Catalogue_Name`, `Domain`, `" . $nc_core->page->get_field_name('language') . "`, `Template_ID`, `Read_Access_ID`, `Write_Access_ID`, `Edit_Access_ID`, `Checked_Access_ID`, `Delete_Access_ID`, `Subscribe_Access_ID`, `Moderation_ID`, `Checked`, `Priority`, `Created`, `Mirrors`, `Robots`, `" . $lm_type . "`, `TemplateSettings` , `ncOfflineText`, `ncMobile`, `ncMobileSrc`, `ncMobileRedirect`, `ncMobileIdentity`, `ncResponsive`) "; $insert .= "VALUES ("; for ($i = 0; $i < $fldCount; $i++) { if ($fldTypeOfEdit[$i] == 3 || $fldTypeOfEdit[$i] == 2 && !nc_field_check_admin_perm()) { continue; } // поле недоступно никому или доступно администратору но нет прав администратора if (isset(${$fld[$i] . 'Defined'}) && ${$fld[$i] . 'Defined'} == true) { $insert .= ${$fld[$i] . 'NewValue'} . ","; } else { $insert .= $fldValue[$i] . ","; } } if (nc_module_check_by_keyword("cache")) { $insert .= "'" . intval($Cache_Access_ID) . "',"; $insert .= "'" . intval($Cache_Lifetime) . "',"; } $insert .= "'" . $db->escape($Catalogue_Name) . "',"; $insert .= "'" . $db->escape($Domain) . "',"; $insert .= "'" . $db->escape($nc_core->input->fetch_get_post('language') != '' ? $nc_core->input->fetch_get_post('language') : MAIN_LANG) . "',"; $insert .= "'" . $db->escape($Template_ID) . "',"; $insert .= "'" . intval($Read_Access_ID) . "',"; $insert .= "'" . intval($Write_Access_ID) . "',"; $insert .= "'" . intval($Edit_Access_ID) . "',"; $insert .= "'" . intval($Checked_Access_ID) . "',"; $insert .= "'" . intval($Delete_Access_ID) . "',"; $insert .= "'" . intval($Subscribe_Access_ID) . "',"; $insert .= "'" . intval($Moderation_ID) . "',"; $insert .= "'" . intval($Checked) . "',"; $insert .= "'" . intval($Priority) . "',"; $insert .= "'" . date("Y-m-d H:i:s") . "',"; $insert .= "'" . $db->escape($Mirrors) . "',"; $insert .= "'" . $db->escape($Robots) . "',"; $insert .= "'" . intval($last_modified_type) . "',"; $insert .= "'" . $db->escape($TemplateSettings) . "',"; $insert .= "'" . $db->escape($ncOfflineText) . "',"; $insert .= "'" . intval($ncMobile) . "',"; $insert .= "'" . intval($ncMobileSrc) . "',"; $insert .= "'" . intval($ncMobileRedirect) . "',"; $insert .= "'" . intval($ncMobileIdentity) . "',"; $insert .= "'" . intval($ncResponsive) . "'"; $insert .= ")"; // execute core action $nc_core->event->execute("addCataloguePrep", 0); $db->query($insert); if ($db->is_error) { throw new nc_Exception_DB_Error($db->last_query, $db->last_error); } $CatalogueID = $db->insert_id; // execute core action $nc_core->event->execute("addCatalogue", $CatalogueID); $message = $CatalogueID; if (nc_module_check_by_keyword("comments")) { if ($CommentAccessID > 0) { // add comment relation $CommentRelationID = nc_comments::addRule($db, array($message), $CommentAccessID, $CommentsEditRules, $CommentsDeleteRules); // update inserted data $db->query("UPDATE `Catalogue` SET `Comment_Rule_ID` = '" . (int) $CommentRelationID . "' WHERE `Catalogue_ID` = '" . (int) $message . "'"); } } // проверка названия раздела if (!$TitleSubIDName || !$E404SubIDName) { nc_print_status(CONTROL_CONTENT_SUBDIVISION_INDEX_ERROR_THREE_NAME, 'error'); return false; } // проверка символов для ключевого слова if (!$nc_core->subdivision->validate_hidden_url($TitleSubIDKeyword) || !$nc_core->subdivision->validate_hidden_url($E404SubIDKeyword)) { nc_print_status(CONTROL_CONTENT_SUBDIVISION_SUBCLASS_ERROR_KEYWORD_INVALID, 'error'); return false; } // execute core action $nc_core->event->execute("addSubdivisionPrep", $CatalogueID, 0); // Добавление раздела для титульной страницы $db->query("INSERT INTO `Subdivision`\n SET `Catalogue_ID` = '" . intval($CatalogueID) . "',\n `Parent_Sub_ID` = 0,\n `Subdivision_Name` = '" . $db->escape($TitleSubIDName) . "',\n `Template_ID` = '" . intval($TitleTemplateID) . "',\n `Checked` = 0,\n `EnglishName` = '" . $db->escape($TitleSubIDKeyword) . "',\n `Hidden_URL` = '/" . $db->escape($TitleSubIDKeyword) . "/',\n `Priority` = 0"); $title_sub_id = $db->insert_id; // execute core action $nc_core->event->execute("addSubdivision", $CatalogueID, $title_sub_id); // execute core action $nc_core->event->execute("addSubdivisionPrep", $CatalogueID, 0); // Добавление раздела для титульной страницы $db->query("INSERT INTO `Subdivision`\n SET `Catalogue_ID` = '" . $CatalogueID . "',\n `Parent_Sub_ID` = 0,\n `Subdivision_Name` = '" . $db->escape($E404SubIDName) . "',\n `Template_ID` = '" . intval($E404TemplateID) . "',\n `Checked` = 0,\n `EnglishName` = '" . $db->escape($E404SubIDKeyword) . "',\n `Hidden_URL` = '/" . $db->escape($E404SubIDKeyword) . "/',\n `Priority` = 1"); $e404_sub_id = $db->insert_id; // execute core action $nc_core->event->execute("addSubdivision", $CatalogueID, $e404_sub_id); // для этого апдейта не нужно вызывать трансляцию события $db->query("UPDATE `Catalogue` SET `Title_Sub_ID` = '" . $title_sub_id . "', `E404_Sub_ID` = '" . $e404_sub_id . "' WHERE `Catalogue_ID` = '" . $CatalogueID . "'"); //добавление системной настройки режима работы магазина. if (nc_module_check_by_keyword("netshop")) { $db->query("INSERT INTO `Settings` (`Key`, `Value`, `Module`, `Catalogue_ID`) VALUES ('nc_shop_mode_" . $CatalogueID . "', '2', 'system', '0')"); } } if ($type == 2) { $cur_checked = $db->get_var("SELECT `Checked` FROM `Catalogue` WHERE `Catalogue_ID` = '" . $CatalogueID . "'"); if (nc_module_check_by_keyword("comments")) { // get rule id $CommentData = nc_comments::getRuleData($db, array($CatalogueID)); $CommentRelationID = $CommentData['ID']; // do something switch (true) { case $CommentAccessID > 0 && $CommentRelationID: // update comment rules nc_comments::updateRule($db, array($CatalogueID), $CommentAccessID, $CommentsEditRules, $CommentsDeleteRules); break; case $CommentAccessID > 0 && !$CommentRelationID: // add comment relation $CommentRelationID = nc_comments::addRule($db, array($CatalogueID), $CommentAccessID, $CommentsEditRules, $CommentsDeleteRules); break; case $CommentAccessID <= 0 && $CommentRelationID: // delete comment rules nc_comments::dropRuleCatalogue($db, $CatalogueID); $CommentRelationID = 0; break; } } $update = " UPDATE `Catalogue` SET "; for ($i = 0; $i < $fldCount; $i++) { if ($fldTypeOfEdit[$i] == 3) { continue; } // поле недоступно никому if (isset(${$fld[$i] . 'Defined'}) && ${$fld[$i] . 'Defined'} == true) { $update .= $fld[$i] . "=" . ${$fld[$i] . 'NewValue'} . ","; } else { $update .= $fld[$i] . "=" . $fldValue[$i] . ","; } } $update .= "`Catalogue_Name` = '" . $db->escape($Catalogue_Name) . "',"; $update .= "`Domain` = '" . $db->escape($Domain) . "',"; $update .= "`Template_ID` = " . intval($Template_ID) . ","; $update .= "`Read_Access_ID` = '" . intval($Read_Access_ID) . "',"; $update .= "`Write_Access_ID` = '" . intval($Write_Access_ID) . "',"; $update .= "`Edit_Access_ID` = '" . intval($Edit_Access_ID) . "',"; $update .= "`Checked_Access_ID` = '" . intval($Checked_Access_ID) . "',"; $update .= "`Delete_Access_ID` = '" . intval($Delete_Access_ID) . "',"; $update .= "`Subscribe_Access_ID` = '" . intval($Subscribe_Access_ID) . "',"; if (nc_module_check_by_keyword("cache")) { $update .= "`Cache_Access_ID` = '" . intval($Cache_Access_ID) . "',"; $update .= "`Cache_Lifetime` = '" . intval($Cache_Lifetime) . "',"; } if (nc_module_check_by_keyword("comments")) { $update .= "`Comment_Rule_ID` = '" . intval($CommentRelationID) . "',"; } $update .= "`Moderation_ID` = '" . intval($Moderation_ID) . "',"; $update .= "`Checked` = '" . intval($Checked) . "',"; $update .= "`Priority` = '" . intval($Priority) . "',"; $update .= "`Mirrors` = '" . $db->escape($Mirrors) . "',"; $update .= "`Robots` = '" . $db->escape($Robots) . "',"; $update .= "`Title_Sub_ID` = '" . intval($TitleSubID) . "',"; $update .= "`E404_Sub_ID` = '" . intval($E404SubID) . "',"; $update .= "`" . $lm_type . "` = '" . intval($last_modified_type) . "',"; $update .= "`DisallowIndexing`= '" . intval($DisallowIndexing) . "',"; $update .= "`" . $nc_core->page->get_field_name('language') . "` = '" . $nc_core->input->fetch_get_post('language') . "',"; if ($nc_core->modules->get_by_keyword('search')) { $update .= "`" . $sm_field . "` = '" . $nc_core->input->fetch_get_post('sitemap_include') . "',"; $update .= "`" . $sm_change_field . "` = '" . $nc_core->input->fetch_get_post('sitemap_changefreq') . "',"; $update .= "`" . $sm_priority_field . "` = '" . str_replace(',', '.', sprintf("%.1f", doubleval($nc_core->input->fetch_get_post('sitemap_priority')))) . "',"; } $update .= "`TemplateSettings` = '" . $db->escape($TemplateSettings) . "',"; $update .= "`ncOfflineText` = '" . $db->escape($ncOfflineText) . "',"; $update .= "`ncMobile` = '" . intval($ncMobile) . "',"; $update .= "`ncMobileSrc` = '" . intval($ncMobileSrc) . "',"; $update .= "`ncMobileRedirect` = '" . intval($ncMobileRedirect) . "',"; $update .= "`ncMobileIdentity` = '" . intval($ncMobileIdentity) . "',"; $update .= "`ncResponsive` = '" . intval($ncResponsive) . "',"; $update .= "`DisplayType` = '" . $db->escape($DisplayType) . "'"; $update .= " WHERE `Catalogue_ID` = " . $CatalogueID; // execute core action $nc_core->event->execute("updateCataloguePrep", $CatalogueID); if ($cur_checked != $Checked) { $nc_core->event->execute($Checked ? "checkCataloguePrep" : "uncheckCataloguePrep", $CatalogueID); } $db->query($update); if ($db->is_error) { throw new nc_Exception_DB_Error($db->last_query, $db->last_error); } // execute core action $nc_core->event->execute("updateCatalogue", $CatalogueID); // произошло включение / выключение if ($cur_checked != $Checked) { $nc_core->event->execute($Checked ? "checkCatalogue" : "uncheckCatalogue", $CatalogueID); } } /* * */ if (is_array($filetable_lastid) && !empty($filetable_lastid)) { foreach ($filetable_lastid as $id) { $db->query("UPDATE `Filetable` SET `Message_ID` = '" . $message . "' WHERE `ID` = '" . intval($id) . "'"); } } /* * */ if ($tmpFile) { @mkdir($FILES_FOLDER . "c/", $DIRCHMOD); } for ($i = 0; $i < count($tmpFile); $i++) { eval("\$tmpNewFile[\$i] = \"" . $tmpNewFile[$i] . "\";"); if ($FileFS[$i] == NC_FS_PROTECTED || $FileFS[$i] == NC_FS_ORIGINAL) { @rename($nc_core->FILES_FOLDER . $tmpNewFile[$i], $nc_core->FILES_FOLDER . $File_PathNew[$i] . $tmpNewFile[$i]); } else { @rename($nc_core->FILES_FOLDER . $tmpFile[$i], $nc_core->FILES_FOLDER . $File_Path[$i] . $tmpNewFile[$i]); } @chmod($FILES_FOLDER . "c/" . $tmpNewFile[$i], $FILECHMOD); } // сброс $nc_core->catalogue->load_all(); return true; }
function ActionUserCompleted($action_file, $type) { global $nc_core, $db, $ROOT_FOLDER, $admin_mode, $perm; global $systemTableID, $systemTableName, $systemMessageID; global $FILES_FOLDER, $INCLUDE_FOLDER; global $DIRCHMOD, $FILECHMOD, $AUTHORIZE_BY; $params = array('Checked', 'InsideAdminAccess', 'PermissionGroupID', 'Catalogue_ID', 'Password1', 'Password2', 'UserID', 'posting'); foreach ($params as $v) { global ${$v}; } $st = new nc_Component(0, 3); foreach ($st->get_fields() as $v) { $name = 'f_' . $v['name']; global ${$name}; if ($v['type'] == 6) { global ${$name . "_old"}; global ${"f_KILL" . $v['id']}; } if ($v['type'] == 8) { global ${$name . "_day"}; global ${$name . "_month"}; global ${$name . "_year"}; global ${$name . "_hours"}; global ${$name . "_minutes"}; global ${$name . "_seconds"}; } } $UserID = intval($UserID); $Checked = intval($Checked); $ret = 0; // возврщаемое значение (текст ошибки или 0) require_once $INCLUDE_FOLDER . "s_files.inc.php"; $is_there_any_files = getFileCount(0, $systemTableID); $user_table_mode = true; if ($type == 1) { $action = "add"; } else { $action = "change"; $message = $UserID; } $Priority += 0; nc_check_availability_candidates_for_delete_in_multifile_and_delete(); nc_rename_multifile(); require $ROOT_FOLDER . "message_fields.php"; if ($posting == 0) { return $warnText; } require $ROOT_FOLDER . "message_put.php"; if (empty($PermissionGroupID)) { return CONTROL_USER_FUNC_GROUP_ERROR; } // значение, которое пойдет в таблицу User // для совместимости со старыми версиями $mainPermissionGroupID = intval(min($PermissionGroupID)); $groups_with_more_rights = $perm->GetGroupWithMoreRights(); //нельзя добавить в группу с большими правами $add_groups_with_more_rights = array_intersect($PermissionGroupID, $groups_with_more_rights); if (!empty($add_groups_with_more_rights)) { return $warnText = NETCAT_MODERATION_ERROR_NORIGHT; } eval("\$Login = \$f_{$AUTHORIZE_BY};"); if ($type == 1) { $Password = $Password1; for ($i = 0; $i < $fldCount; $i++) { if (isset(${$fld[$i] . 'Defined'}) && ${$fld[$i] . 'Defined'} == true) { $fieldString .= "`" . $fld[$i] . "`,"; $valueString .= ${$fld[$i] . 'NewValue'} . ","; } } $insert = "INSERT INTO User ( " . $fieldString; $insert .= "PermissionGroup_ID, Catalogue_ID, Password, Checked, Created,InsideAdminAccess) values ( " . $valueString; $insert .= "'" . $mainPermissionGroupID . "', "; if (isset($_POST['Catalogue_ID'])) { $insert .= +$_POST['Catalogue_ID'] . ", "; } else { $insert .= "0, "; } $insert .= $nc_core->MYSQL_ENCRYPT . "('" . $Password . "'),'{$Checked}','" . date("Y-m-d H:i:s") . "', '" . (int) $InsideAdminAccess . "')"; // execute core action $nc_core->event->execute("addUserPrep", 0); $Result = $db->query($insert); $UserID = $db->insert_id; $message = $UserID; if ($Result) { // execute core action $nc_core->event->execute("addUser", $message); nc_print_status(CONTROL_USER_NEW_ADDED, 'ok'); foreach ($PermissionGroupID as $v) { nc_usergroup_add_to_group($UserID, $v); } } else { return CONTROL_USER_NEW_NOTADDED . "<br/>" . sprintf(NETCAT_ERROR_SQL, $db->last_query, $db->last_error); } } if ($type == 2) { $cur_checked = $db->get_var("SELECT `Checked` FROM `User` WHERE `User_ID` = '" . $UserID . "'"); $update = "update User set "; for ($i = 0; $i < $fldCount; $i++) { if ($fldTypeOfEdit[$i] == 3 || $fldTypeOfEdit[$i] == 2 && !nc_field_check_admin_perm()) { continue; } // поле недоступно никому или доступно администратору но нет прав администратора if (isset(${$fld[$i] . 'Defined'}) && ${$fld[$i] . 'Defined'} == true) { $update .= $fld[$i] . "=" . ${$fld[$i] . 'NewValue'} . ","; } else { $update .= $fld[$i] . "=" . ($fldValue[$i] ? $fldValue[$i] : "NULL") . ","; } } $update .= "Checked=\"" . $Checked . "\","; $update .= "PermissionGroup_ID=\"" . $mainPermissionGroupID . "\","; $update .= "InsideAdminAccess=" . (int) $InsideAdminAccess; if (isset($_POST['Catalogue_ID'])) { $update .= ", Catalogue_ID=" . (int) $_POST['Catalogue_ID']; } $update .= " where User_ID=" . $UserID; // execute core action $nc_core->event->execute("updateUserPrep", $UserID); if ($cur_checked != $Checked) { $nc_core->event->execute($Checked ? "checkUserPrep" : "uncheckUserPrep", $UserID); } $Result = $db->query($update); // execute core action $nc_core->event->execute("updateUser", $UserID); $db->query("DELETE FROM `User_Group` WHERE `User_ID`='" . intval($UserID) . "'"); foreach ($PermissionGroupID as $v) { nc_usergroup_add_to_group($UserID, $v, 0); } // произошла смена состояния пользователя if ($cur_checked != $Checked) { $nc_core->event->execute($Checked ? "checkUser" : "uncheckUser", $UserID); } } if (is_array($SQL_multifield)) { nc_multifield_sql_exec($message, $SQL_multifield); } // Обновление в таблице с файлами if (!empty($filetable_lastid)) { $db->query("UPDATE `Filetable` SET `Message_ID`='" . $message . "' WHERE ID IN (" . join(',', $filetable_lastid) . ")"); } // create dir @mkdir($FILES_FOLDER . "u/", $DIRCHMOD); /* * */ for ($i = 0; $i < count($tmpFile); $i++) { eval("\$tmpNewFile[\$i] = \"" . $tmpNewFile[$i] . "\";"); @rename($FILES_FOLDER . $tmpFile[$i], $FILES_FOLDER . $File_Path[$i] . $tmpNewFile[$i]); @chmod($FILES_FOLDER . $File_Path[$i] . $tmpNewFile[$i], $FILECHMOD); } // привязка токена $nc_token_login = $nc_core->input->fetch_get_post('nc_token_login'); $nc_token_key = $nc_core->input->fetch_get_post('nc_token_key'); if ($nc_token_login && $nc_token_key && $UserID) { $db->query("INSERT INTO `Auth_Token`\n SET `Login` = '" . $db->escape($nc_token_login) . "',\n `PublicKey` = '" . $db->escape($nc_token_key) . "',\n `User_ID` = '" . $UserID . "' "); } $nc_token_destroy = $nc_core->input->fetch_get_post('nc_token_destroy'); if ($nc_token_destroy) { $nc_auth_token = new nc_auth_token(); $nc_auth_token->delete_by_id($nc_token_destroy); } return 0; }
function ActionSubdivisionCompleted($type) { global $HTTP_ROOT_PATH, $HTTP_DOMAIN, $SUB_FOLDER; global $loc, $perm, $admin_mode, $nc_core; global $db, $ROOT_FOLDER, $FILECHMOD, $DIRCHMOD; global $systemTableID, $systemTableName, $systemMessageID; global $FILES_FOLDER, $INCLUDE_FOLDER, $MODULE_FOLDER, $ADMIN_FOLDER; require_once $INCLUDE_FOLDER . "s_files.inc.php"; $is_there_any_files = getFileCount(0, $systemTableID); $lm_type = $nc_core->page->get_field_name('last_modified_type'); $sm_field = $nc_core->page->get_field_name('sitemap_include'); $sm_change_field = $nc_core->page->get_field_name('sitemap_changefreq'); $sm_priority_field = $nc_core->page->get_field_name('sitemap_priority'); $params = array('Subdivision_Name', 'EnglishName', 'TemplateID', 'ReadAccessID', 'WriteAccessID', 'EditAccessID', 'SubscribeAccessID', 'CheckedAccessID', 'DeleteAccessID', 'ModerationID', 'Checked', 'Priority', 'ExternalURL', 'UseMultiSubClass', 'CacheAccessID', 'CacheLifetime', 'CatalogueID', 'SubdivisionID', 'ParentSubID', 'UseEditDesignTemplate', 'Title', 'Keywords', 'Description', 'CommentsEditRules', 'CommentAccessID', 'CommentsDeleteRules', 'posting', 'last_modified_type', 'language', 'title', 'keywords', 'description', 'DisallowIndexing', $sm_field, $sm_change_field, $sm_priority_field); foreach ($params as $v) { ${$v} = $nc_core->input->fetch_get_post($v); } $st = new nc_Component(0, 2); foreach ($st->get_fields() as $v) { $name = 'f_' . $v['name']; global ${$name}; if ($v['type'] == 6) { global ${$name . "_old"}; global ${"f_KILL" . $v['id']}; } } $Priority += 0; if ($type == 1) { $action = "add"; } if ($type == 2) { $action = "change"; $message = $loc->SubdivisionID; } $component = new nc_Component(0, 2); $fl = $component->get_fields(); // prepare template custom settings $settings = $db->get_var("SELECT `CustomSettings` FROM `Template` WHERE `Template_ID` = '" . (int) $TemplateID . "'"); if ($settings) { require_once $ADMIN_FOLDER . "array_to_form.inc.php"; $a2f = new nc_a2f($settings, 'TemplateSettings'); if (!$a2f->validate($_POST['TemplateSettings'])) { $warnText = $a2f->get_validation_errors(); $posting = 0; } $a2f->save($_POST['TemplateSettings']); $TemplateSettings = $a2f->get_values_as_string(); } else { $TemplateSettings = ""; } require $ROOT_FOLDER . "message_fields.php"; if ($posting == 0) { nc_print_status($warnText, 'error'); SubdivisionForm($phase, "index.php", $type); return false; } if (nc_module_check_by_keyword("comments")) { include_once $MODULE_FOLDER . "comments/function.inc.php"; } require $ROOT_FOLDER . "message_put.php"; $db->last_error = ''; if ($type == 1) { $insert = "INSERT INTO `Subdivision` SET "; // fields from system table component (2) for ($i = 0; $i < $fldCount; $i++) { if ($fldTypeOfEdit[$i] == 3 || $fldTypeOfEdit[$i] == 2 && !nc_field_check_admin_perm()) { continue; } // поле недоступно никому или доступно администратору но нет прав администратора // quotes added into the message_put.php! if (isset(${$fld[$i] . 'Defined'}) && ${$fld[$i] . 'Defined'} == true) { $insert .= "`" . $fld[$i] . "` = " . ${$fld[$i] . 'NewValue'} . ", "; } else { $insert .= "`" . $fld[$i] . "` = " . $fldValue[$i] . ", "; } } if (nc_module_check_by_keyword("cache")) { $insert .= "`Cache_Access_ID` = '" . $CacheAccessID . "', "; $insert .= "`Cache_Lifetime` = '" . $CacheLifetime . "',"; } $insert .= "`Catalogue_ID` = '" . $loc->CatalogueID . "',"; $insert .= "`Parent_Sub_ID` = '" . $loc->ParentSubID . "',"; $insert .= "`Subdivision_Name` = '" . $Subdivision_Name . "',"; $insert .= "`Template_ID` = '" . $TemplateID . "',"; $insert .= "`Read_Access_ID` = '" . $ReadAccessID . "',"; $insert .= "`Write_Access_ID` = '" . $WriteAccessID . "',"; $insert .= "`Edit_Access_ID` = '" . $EditAccessID . "',"; $insert .= "`Checked_Access_ID` = '" . $CheckedAccessID . "',"; $insert .= "`Delete_Access_ID` = '" . $DeleteAccessID . "',"; $insert .= "`Subscribe_Access_ID` = '" . $SubscribeAccessID . "',"; $insert .= "`Moderation_ID` = '" . $ModerationID . "',"; $insert .= "`Checked` = '" . $Checked . "',"; $insert .= "`ExternalURL` = '" . $ExternalURL . "',"; $insert .= "`EnglishName` = '" . $EnglishName . "',"; $insert .= "`Favorite` = '" . $Favorite . "',"; $insert .= "`Created` = '" . date("Y-m-d H:i:s") . "',"; $insert .= "`Priority` = '" . $Priority . "',"; $insert .= "`UseMultiSubClass` = '" . $UseMultiSubClass . "',"; $insert .= "`UseEditDesignTemplate` = '" . $UseEditDesignTemplate . "',"; $insert .= "`" . $lm_type . "` = '" . intval($last_modified_type) . "',"; $insert .= "`TemplateSettings` = '" . $db->escape($TemplateSettings) . "'"; // execute core action $nc_core->event->execute("addSubdivisionPrep", $loc->CatalogueID, 0); $Result = $db->query($insert); $systemMessageID = $db->insert_id; //sql error if ($db->last_error) { return false; } // execute core action $nc_core->event->execute("addSubdivision", $loc->CatalogueID, $systemMessageID); $message = $systemMessageID; // set insert_id in Filetable, becouse Message_ID and File_Path fields are empty if (!empty($filetable_lastid)) { $db->query("UPDATE `Filetable`\n SET `Message_ID` = '" . $message . "', `File_Path` = '/" . $message . "/'\n WHERE `ID` IN(" . join(',', $filetable_lastid) . ")"); } // default value if (!isset($DIRCHMOD)) { $DIRCHMOD = 0777; } // create dir @mkdir($FILES_FOLDER . $message . "/", $DIRCHMOD); // end set insert_id block if (nc_module_check_by_keyword("comments")) { if ($CommentAccessID > 0) { // add comment relation $CommentRelationID = nc_comments::addRule($db, array($loc->CatalogueID, $message), $CommentAccessID, $CommentsEditRules, $CommentsDeleteRules); // update inserted data $db->query("UPDATE `Subdivision` SET `Comment_Rule_ID` = '" . (int) $CommentRelationID . "' WHERE `Subdivision_ID` = '" . (int) $message . "'"); } } } if ($type == 2) { $cur_checked = $db->get_var("SELECT `Checked` FROM `Subdivision` WHERE `Subdivision_ID` = '" . $loc->SubdivisionID . "'"); if (nc_module_check_by_keyword("comments")) { // get rule id $CommentData = nc_comments::getRuleData($db, array($loc->CatalogueID, $loc->SubdivisionID)); $CommentRelationID = $CommentData['ID']; // do something switch (true) { case $CommentAccessID > 0 && $CommentRelationID: // update comment rules nc_comments::updateRule($db, array($loc->CatalogueID, $loc->SubdivisionID), $CommentAccessID, $CommentsEditRules, $CommentsDeleteRules); break; case $CommentAccessID > 0 && !$CommentRelationID: // add comment relation $CommentRelationID = nc_comments::addRule($db, array($loc->CatalogueID, $loc->SubdivisionID), $CommentAccessID, $CommentsEditRules, $CommentsDeleteRules); break; case $CommentAccessID <= 0 && $CommentRelationID: // delete comment rules nc_comments::dropRuleSubdivision($db, $loc->SubdivisionID); $CommentRelationID = 0; break; } } $update = "UPDATE `Subdivision` SET "; for ($i = 0; $i < $fldCount; $i++) { if ($fldTypeOfEdit[$i] == 3) { continue; } // поле недоступно никому $update .= "`" . $fld[$i] . "` = " . $fldValue[$i] . ", "; } if (!empty($fl)) { foreach ($fl as $field) { if ($field['usage']) { $update .= "`" . $db->escape($field['name']) . "` = '" . $db->escape($nc_core->input->fetch_get_post($field['name'])) . "', "; } } } $update .= "`Subdivision_Name`= '" . $Subdivision_Name . "',"; $update .= "`ExternalURL`= '" . $ExternalURL . "',"; $update .= "`EnglishName` = '" . $EnglishName . "',"; $update .= "`Template_ID` = " . $TemplateID . ","; $update .= "`Read_Access_ID` = '" . $ReadAccessID . "',"; $update .= "`Write_Access_ID` = '" . $WriteAccessID . "',"; $update .= "`Edit_Access_ID` = '" . $EditAccessID . "',"; $update .= "`Checked_Access_ID` = '" . $CheckedAccessID . "',"; $update .= "`Delete_Access_ID` = '" . $DeleteAccessID . "',"; $update .= "`Subscribe_Access_ID` = '" . $SubscribeAccessID . "',"; if (nc_module_check_by_keyword("cache")) { $update .= "`Cache_Access_ID` = '" . $CacheAccessID . "',"; $update .= "`Cache_Lifetime` = '" . $CacheLifetime . "',"; } if (nc_module_check_by_keyword("comments")) { $update .= "`Comment_Rule_ID` = '" . $CommentRelationID . "',"; } $update .= "`Moderation_ID` = '" . $ModerationID . "',"; $update .= "`Checked` = '" . $Checked . "',"; $update .= "`Priority`= " . $Priority . ","; $update .= "`Favorite`= '" . $Favorite . "',"; $update .= "`UseMultiSubClass`= '" . $UseMultiSubClass . "',"; $update .= "`UseEditDesignTemplate`= '" . $UseEditDesignTemplate . "',"; $update .= "`DisallowIndexing`= '" . intval($DisallowIndexing) . "',"; $update .= "`" . $sm_field . "`= '" . $nc_core->input->fetch_get_post('sitemap_include') . "',"; $update .= "`" . $nc_core->page->get_field_name('language') . "` = '" . $db->escape($language) . "',"; $update .= "`" . $nc_core->page->get_field_name('title') . "` = '" . $db->escape($title) . "',"; $update .= "`" . $nc_core->page->get_field_name('keywords') . "` = '" . $db->escape($keywords) . "',"; $update .= "`" . $nc_core->page->get_field_name('description') . "` = '" . $db->escape($description) . "',"; $update .= "`" . $lm_type . "` = '" . intval($last_modified_type) . "',"; if ($nc_core->modules->get_by_keyword('search')) { $update .= "`" . $sm_field . "` = '" . $nc_core->input->fetch_get_post('sitemap_include') . "',"; $update .= "`" . $sm_change_field . "` = '" . $nc_core->input->fetch_get_post('sitemap_changefreq') . "',"; $update .= "`" . $sm_priority_field . "` = '" . str_replace(',', '.', sprintf("%.1f", doubleval($nc_core->input->fetch_get_post('sitemap_priority')))) . "',"; } $update .= "`TemplateSettings` = '" . $db->escape($TemplateSettings) . "'"; $update .= " WHERE `Subdivision_ID` = " . $loc->SubdivisionID; // execute core action $nc_core->event->execute("updateSubdivisionPrep", $loc->CatalogueID, $loc->SubdivisionID); $nc_core->event->execute($Checked ? "checkSubdivisionPrep" : "uncheckSubdivisionPrep", $loc->CatalogueID, $loc->SubdivisionID); $Result = $db->query($update); //sql error if ($db->last_error) { return false; } // execute core action $nc_core->event->execute("updateSubdivision", $loc->CatalogueID, $loc->SubdivisionID); // произошло включение / выключение if ($cur_checked != $Checked) { $nc_core->event->execute($Checked ? "checkSubdivision" : "uncheckSubdivision", $loc->CatalogueID, $loc->SubdivisionID); } $changed_cc = array(); // RSS $cc_in_sub = $db->get_results("SELECT `Sub_Class_ID` as `id`, `AllowRSS` as `cur` FROM `Sub_Class` WHERE `Subdivision_ID` = '" . $loc->SubdivisionID . "' ", ARRAY_A); if (!empty($cc_in_sub)) { foreach ($cc_in_sub as $v) { // значение, пришедшие из формы $allow_rss = intval($nc_core->input->fetch_get_post('AllowRSS' . $v['id'])); // в случае, если значение изменилось if ($allow_rss != $v['cur']) { $db->query("UPDATE `Sub_Class` SET `AllowRSS` = '" . $allow_rss . "' WHERE `Sub_Class_ID` = '" . $v['id'] . "' "); $changed_cc[] = $v['id']; } } } // визуальные настройки $CustomSettings = ""; if ($nc_core->input->fetch_get_post('custom_subclass_id')) { $settings = $db->get_var("SELECT `CustomSettingsTemplate` FROM `Class`\n WHERE `Class_ID` = '" . intval($nc_core->input->fetch_get_post('custom_class_id')) . "'"); if ($settings) { require_once $nc_core->ADMIN_FOLDER . "array_to_form.inc.php"; $a2f = new nc_a2f($settings, 'CustomSettings'); if (!$a2f->validate($_POST['CustomSettings'])) { $error = $a2f->get_validation_errors(); nc_print_status($error, 'error'); } else { $a2f->save($_POST['CustomSettings']); $CustomSettings = $a2f->get_values_as_string(); $cur_settings = $db->get_var("SELECT `CustomSettings` FROM `Sub_Class`\n WHERE `Sub_Class_ID` = '" . intval($nc_core->input->fetch_get_post('custom_subclass_id')) . "'"); if ($CustomSettings != $cur_settings) { $nc_core->event->execute("updateSubClassPrep", $loc->CatalogueID, $loc->SubdivisionID, $changed_cc); $db->query("UPDATE `Sub_Class` SET `CustomSettings` = '" . $db->escape($CustomSettings) . "'\n WHERE `Sub_Class_ID` = '" . intval($nc_core->input->fetch_get_post('custom_subclass_id')) . "'"); $changed_cc[] = intval($nc_core->input->fetch_get_post('custom_subclass_id')); } } } } // трансляция события для компонент в разделе if (!empty($changed_cc)) { $changed_cc = array_unique($changed_cc); $nc_core->event->execute("updateSubClass", $loc->CatalogueID, $loc->SubdivisionID, $changed_cc); } } if ($type == 1 || $type == 2) { $hidden_url = GetHiddenURL($loc->ParentSubID); UpdateHiddenURL($hidden_url ? $hidden_url : "/", $loc->ParentSubID, $loc->CatalogueID); } // поисковая оптимизация, проверка if (!empty($fl)) { $real_value = $nc_core->page->get_meta_tags("http://" . $nc_core->DOMAIN_NAME . nc_folder_path($message)); foreach ($fl as $field) { if ($real_value[$field['usage']] && $field['usage'] && $nc_core->input->fetch_get_post($field['name']) && $nc_core->input->fetch_get_post($field['name']) != $real_value[$field['usage']]) { nc_print_status(sprintf(CONTROL_CONTENT_SUBDIVISION_SEO_VALUE_NOT_SETTINGS, $field['usage']), 'info'); } } } // work with files for ($i = 0; $i < count($tmpFile); $i++) { eval("\$tmpNewFile[\$i] = \"" . $tmpNewFile[$i] . "\";"); eval("\$File_PathNew[\$i] = \"" . $File_PathNew[$i] . "\";"); eval("\$File_Path[\$i] = \"" . $File_Path[$i] . "\";"); if ($fld_name[$i]) { $db->query("UPDATE `Subdivision`\n SET `" . $fld_name[$i] . "` = REPLACE(" . $fld_name[$i] . ", '\$message', Subdivision_ID )\n WHERE Subdivision_ID = '" . $message . "'"); } if ($FileFS[$i] == NC_FS_PROTECTED || $FileFS[$i] == NC_FS_ORIGINAL) { @rename($nc_core->FILES_FOLDER . $tmpNewFile[$i], $nc_core->FILES_FOLDER . $File_PathNew[$i] . $tmpNewFile[$i]); } else { @rename($nc_core->FILES_FOLDER . $tmpFile[$i], $nc_core->FILES_FOLDER . $File_Path[$i] . $tmpNewFile[$i]); } @chmod($nc_core->FILES_FOLDER . $File_PathNew[$i] . $tmpNewFile[$i], $nc_core->FILECHMOD); } if (!empty($filetable_lastid)) { $db->query("UPDATE `Filetable`\n SET `Message_ID` = '" . $message . "', `File_Path` = '/" . $message . "/'\n WHERE `ID` IN(" . join(',', $filetable_lastid) . ")"); } return $type == 1 && $message ? $message : ($type == 2 && $loc->SubdivisionID ? $loc->SubdivisionID : false); }