function borrar_foto($id) { global $__BD; $objResponse = new xajaxResponse(); $codigo = ''; $ordenSQL = "select referencia,nomfichero from articulosfotos where id={$id}"; $result = $__BD->db_query($ordenSQL); $row = $__BD->db_fetch_row($result); $referencia = $row[0]; $nomFich = $row[1]; $fichNor = _IMG_ROOT . 'img_normal/' . $referencia . '/' . $nomFich; $fichThum = _IMG_ROOT . 'img_thumb/' . $referencia . '/' . $nomFich; $fichMed = _IMG_ROOT . 'img_mediana/' . $referencia . '/' . $nomFich; $fichSuperThum = _IMG_ROOT . 'img_superthumb/' . $referencia . '/' . $nomFich; if (file_exists($fichThum)) { unlink($fichThum); } if (file_exists($fichNor)) { unlink($fichNor); } if (file_exists($fichMed)) { unlink($fichMed); } if (file_exists($fichSuperThum)) { unlink($fichSuperThum); } $ordenSQL = "delete from articulosfotos where id={$id}"; $__BD->db_query($ordenSQL); $objResponse->remove('imagen_' . $id); return $objResponse; }
function removeHandler($sId, $sHandler) { $objResponse = new xajaxResponse(); $objResponse->removeHandler($sId, "click", $sHandler); $objResponse->remove('handler' . $sHandler); return $objResponse; }
function removeInput($aInputData) { $sId = $aInputData['inputId']; $objResponse = new xajaxResponse(); $objResponse->remove($sId); return $objResponse; }
function streamStream($url, $size) { global $smarty; $objResponse = new xajaxResponse(); preg_match('/(\\d+)\\sx\\s(\\d+)/', $size, $matches); $width = (int) $matches[1]; $height = (int) $matches[1]; $objResponse->remove('ajax-gPlayer'); $objResponse->append('ajax-contentBubble', 'innerHTML', $smarty->fetch('el-player.tpl')); $objResponse->script("loadFile('{$url}', {$width}, {$height}, 'true')"); return $objResponse; }
function delete_file($arquivoId) { global $user; require_once "lib/persistentObj/PersistentObjectFactory.php"; $arquivo = PersistentObjectFactory::createObject("Publication", (int) $arquivoId); $objResponse = new xajaxResponse(); if (!isset($arquivo->user) || $arquivo->user != $user) { return $objResponse; } $arquivo->delete(); $objResponse->remove("ajax-pendente-{$arquivoId}"); return $objResponse; }
function deleteComment($commentId) { global $arquivo, $user, $smarty; foreach ($arquivo->comments as $comment) { if ($comment->id == $commentId) { $c =& $comment; break; } } $objResponse = new xajaxResponse(); if (!$c || $c->user != $user) { return $objResponse; } $objResponse->remove("ajax-commentCont-{$c->id}"); $c->delete(); $objResponse->assign("ajax-commentCount", "innerHTML", count($arquivo->comments) - 1); return $objResponse; }
function Lenta_AddFav($fav_id, $pfx, $user_id, $undo = 0, $priority = 0) { $stars = array(0 => 'bsg.png', 1 => 'bsgr.png', 2 => 'bsy.png', 3 => 'bsr.png'); $objResponse = new xajaxResponse(); $star = "favstar{$pfx}{$fav_id}"; $li = "fav{$pfx}{$fav_id}"; $commune_message_id = $pfx == 'CM' ? $fav_id : NULL; $portfolio_id = $pfx == 'PF' ? $fav_id : NULL; $blog_id = $pfx == 'BL' ? $fav_id : NULL; if (lenta::AddFav($user_id, $commune_message_id, $portfolio_id, $blog_id, $undo, $priority)) { if (!$undo) { $objResponse->assign($star, "src", '/images/bookmarks/' . $stars[$priority]); $sort = $_COOKIE['lenta_fav_order'] != "" ? $_COOKIE['lenta_fav_order'] : "date"; $favs = lenta::GetFavorites($user_id, $sort); $objResponse->assign('lenta_fav_list', 'innerHTML', __lentaPrntFavs($favs, $user_id)); $objResponse->script("{$star}.setAttribute('on',1);"); $objResponse->script("\$('lenta_count_favs').set('html'," . count($favs) . ")"); $objResponse->script('$("lenta_fav_sort_by").setStyle("display","block")'); } else { $objResponse->assign($star, "src", '/images/bookmarks/bsw.png'); $objResponse->remove($li); $objResponse->script("\$('lenta_count_favs').set('html',parseInt(\$('lenta_count_favs').get('html'))-1)"); $objResponse->script("\n {$star}.setAttribute('on',0);\n favBlock = \$('lenta_fav_list');\n if(favBlock) {\n if(favBlock.innerHTML.match(/<LI[^>]*>/i)==null) {\n \$('lenta_fav_sort_by').setStyle('display','none');\n favBlock.innerHTML = 'Нет закладок';\n }\n }\n "); } } return $objResponse; }
function AddFav($backto, $backto2, $message_id, $user_id, $om, $undo, $priority = 0) { $objResponse = new xajaxResponse(); if (get_uid(false) != $user_id) { return $objResponse; } $sort = $_COOKIE['commune_fav_order'] != '' ? $_COOKIE['commune_fav_order'] : 'date'; if (commune::AddFav($message_id, $user_id, $undo, $priority)) { if (!$undo) { $objResponse->assign($backto, 'src', commune::getStarByPR($priority)); //$objResponse->assign($backto, "onclick", 'return true;'); $msg = commune::GetMessage($message_id); $favs = commune::GetFavorites($user_id, NULL, $sort, $msg['commune_id']); $objResponse->assign('favBlock', 'innerHTML', __commPrntFavs($favs, $user_id, $om)); $objResponse->script("{$backto}.setAttribute('on',1);"); } else { $objResponse->assign($backto, 'src', '/images/bookmarks/bsw.png'); //$objResponse->assign($backto, "onclick", "ShowFavFloat({$msg_id}, {$user_id}, {$om})"); $objResponse->remove($backto2); $objResponse->script("\n {$backto}.setAttribute('on',0);\n if(favBlock.innerHTML.match(/<LI[^>]*>/i)==null)\n favBlock.innerHTML = 'Нет закладок';\n "); } } $objResponse->script('communeObj.initFavs();'); return $objResponse; }
function closePopup() { $objResponse = new xajaxResponse(); $objResponse->remove("popup"); $objResponse->removeCSS('includes/layout/overlay.css'); if ($_SESSION['popup_close_redirect'] == 'yes') { $project7 = new editsee_App(); $_SESSION['popup_close_redirect'] = ''; $_SESSION['temp_theme'] = ''; $objResponse->redirect($project7->get_config('es_main_url')); } return $objResponse; }
function deleteFileReference($i, $fileId) { global $arquivo; if ($arquivo->mainFile == (int) $i) { $arquivo->update(array('mainFile' => NULL)); } if ($arquivo->mainFile > (int) $i) { $arquivo->update(array('mainFile' => $arquivo->mainFile--)); } require_once "lib/persistentObj/PersistentObjectFactory.php"; $file = PersistentObjectFactory::createObject("FileReference", (int) $fileId); $file->delete(); $objResponse = new xajaxResponse(); $objResponse->remove("ajax-file{$i}"); return $objResponse; }
/** * Получить список групп в виде SELECT. * * @param integer $selected_group_id ID выбранной группы * @param string $element_id ID <SELECT> для которого надо получить группы */ function GetGroupsForSelect($selected_group_id = 0, $element_id) { session_start(); $objResponse = new xajaxResponse(); if (hasPermissions('ourcontacts')) { $html = ''; $groups = contacts::getGroups(); if ($groups) { $objResponse->remove($element_id); $objResponse->insertAfter($element_id . '_label', 'select', $element_id); $objResponse->assign($element_id, 'name', $element_id); foreach ($groups as $group) { $objResponse->create("{$element_id}", 'option', $element_id . '_o_' . $group['id']); $objResponse->assign($element_id . '_o_' . $group['id'], 'value', $group['id']); $objResponse->assign($element_id . '_o_' . $group['id'], 'innerHTML', $group['title']); if ($group['id'] == $selected_group_id) { $objResponse->assign($element_id . '_o_' . $group['id'], 'selected', true); } } } } return $objResponse; }
function RefuseProjectOffer($po_id, $prj_id, $user_id, $type, $po_reason = 0) { global $session; session_start(); $user = new users(); $prj = new projects(); $prj_offer = new projects_offers(); $po_id = intval($po_id); $prj_id = intval($prj_id); $po_reason = intval($po_reason); $user_id = intval($user_id); $user_name = $user->GetName($user_id, $error); $emp_id = get_uid(false); $emp_name = $user->GetName($emp_id, $error); $pod = new projects_offers_dialogue(); $pod->markReadEmp(array($po_id), $emp_id); $objResponse = new xajaxResponse(); //Не позволяем производить действия с заблокированным проектом if (projects::CheckBlocked(intval($prj_id))) { $objResponse->script("document.location.href='/projects/index.php?pid=" . intval($prj_id) . "'"); } else { $error = ''; $project = $prj->GetPrjCust($prj_id); if ($project['exec_id'] == $user_id) { $error = $prj->ClearExecutor($prj_id, $emp_id); } if (!$error) { $error .= ($error ? ' ' : '') . $prj_offer->SetRefused($po_id, $prj_id, $user_id, $po_reason, true); $project = $prj->GetPrjCust($prj_id); require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/external/base.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/external/api/api.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/external/api/mobile.php'; externalApi_Mobile::addPushMsg($user_id, 'prj_select_reject', array('from_user_id' => $project['user_id'], 'name' => $project['name'], 'project_id' => $project['id'])); list($po_offers_count, $msg_offers_count) = $prj_offer->CountPrjOffers($prj_id, 'offers'); $objResponse->assign('po_offers_count', 'innerHTML', $po_offers_count); if ($msg_offers_count > 0) { $objResponse->assign('op_count_offers_new_msgs', 'innerHTML', '<img src="/images/ico_envelop.gif" alt="" width="10" height="8" border="0"> ' . $msg_offers_count . ' ' . ending($msg_offers_count, 'новое сообщение', 'новых сообщения', 'новых сообщений')); } else { $objResponse->assign('op_count_offers_new_msgs', 'innerHTML', ''); if ($type == 'o') { $objResponse->remove('sort_box'); } } list($po_executor_count, $msg_executor_count) = $prj_offer->CountPrjOffers($prj_id, 'executor'); $objResponse->assign('po_executor_count', 'innerHTML', $po_executor_count); if ($msg_executor_count > 0) { $objResponse->assign('op_count_executor_new_msgs', 'innerHTML', '<img src="/images/ico_envelop.gif" alt="" width="10" height="8" border="0"> ' . $msg_executor_count . ' ' . ending($msg_executor_count, 'новое сообщение', 'новых сообщения', 'новых сообщений')); } else { $objResponse->assign('op_count_executor_new_msgs', 'innerHTML', ''); if ($type == 'i') { $objResponse->remove('sort_box'); } } list($po_candidate_count, $msg_candidate_count) = $prj_offer->CountPrjOffers($prj_id, 'candidate'); $objResponse->assign('po_candidate_count', 'innerHTML', $po_candidate_count); if ($msg_candidate_count > 0) { $objResponse->assign('op_count_candidate_new_msgs', 'innerHTML', '<img src="/images/ico_envelop.gif" alt="" width="10" height="8" border="0"> ' . $msg_candidate_count . ' ' . ending($msg_candidate_count, 'новое сообщение', 'новых сообщения', 'новых сообщений')); } else { $objResponse->assign('op_count_candidate_new_msgs', 'innerHTML', ''); if ($type == 'c') { $objResponse->remove('sort_box'); } } list($po_refuse_count, $msg_refuse_count) = $prj_offer->CountPrjOffers($prj_id, 'refuse'); $objResponse->assign('po_refuse_count', 'innerHTML', $po_refuse_count); if ($msg_refuse_count > 0) { $objResponse->assign('op_count_refuse_new_msgs', 'innerHTML', '<img src="/images/ico_envelop.gif" alt="" width="10" height="8" border="0"> ' . $msg_refuse_count . ' ' . ending($msg_refuse_count, 'новое сообщение', 'новых сообщения', 'новых сообщений')); } else { if ($type == 'r') { $objResponse->remove('sort_box'); } $objResponse->assign('op_count_refuse_new_msgs', 'innerHTML', ''); } //$objResponse->assign("po_b_exec_" . $po_id, "innerHTML", '<a id="po_img_exec_' . $po_id . '" class="b-button-multi__link" onclick="xajax_SelectProjectExecutor(' . $po_id . ', ' . $prj_id . ', ' . $user_id . ', ' . "'" . $type . "'" . ', ' . 0 . ');" href="javascript:void(0)" title="Буду работать с этим человеком."><span class="b-button-multi__inner"><span class="b-button-multi__icon b-button-multi__icon_green"></span><span class="b-button-multi__txt">Исполнитель</span></span></a>'); //$objResponse->assign("po_b_select_" . $po_id, "innerHTML", '<a id="po_img_select_' . $po_id . '" class="b-button-multi__link" onclick="xajax_SelectProjectOffer(' . $po_id . ', ' . $prj_id . ', ' . $user_id . ', ' . "'" . $type . "'" . ');" href="javascript:void(0)" title="Прошел предварительный отбор. Может быть исполнителем"><span class="b-button-multi__inner"><span class="b-button-multi__icon b-button-multi__icon_blue"></span><span class="b-button-multi__txt">Кандидат</span></span></a>'); //$objResponse->assign("po_b_refuse_" . $po_id, "innerHTML", '<a id="po_img_refuse_' . $po_id . '" class="b-button-multi__link" href="javascript:void(0)" title="Этот человек мне не подходит. Может быть в следующий раз."><span class="b-button-multi__inner"><span class="b-button-multi__icon b-button-multi__icon_red"></span><span class="b-button-multi__txt">Отказано</span></span></a>'); $objResponse->script("removeNoteBar('{$user_name['login']}');"); $objResponse->remove('po_' . $po_id); $objResponse->remove('po_u_' . $po_id); $objResponse->remove('po_bar_' . $po_id); } --$_SESSION['offers_on_page']; if ($_SESSION['offers_on_page'] == 0) { $objResponse->script("document.location.href='/projects/index.php?pid=" . intval($prj_id) . '&type=' . $type . "'"); } } return $objResponse; }
function DeleteOpinion($op_id, $from = 'frl') { @session_start(); $op_id = intval($op_id); $objResponse = new xajaxResponse(); $msg = opinions::GetMessageById($op_id); $old_rating = $msg['rating']; if (get_uid(0) == $msg['fromuser_id'] || hasPermissions('users')) { $error = opinions::DeleteMsg($msg['fromuser_id'], $op_id, hasPermissions('users')); } else { $error = 'Вы не можете удалить мнение об этом пользователе.'; } if (!$error) { //$user = new users(); //$user->GetUserByUID($_SESSION['page_user_id']); $ot = $old_rating == 1 ? 'plus' : ($old_rating == -1 ? 'minus' : 'neitral'); $objResponse->call('opinionChConuters', 'ops-' . $from . $ot); ///????? $objResponse->remove("opinion_{$op_id}"); //$objResponse->remove("opid_$op_id"); //$objResponse->remove("form_container"); // @deprecated #0015627 // $objResponse->prepend("messages_container","innerHTML", opinions::printAddForm(get_uid(false),$msg['touser_id'],$from)); //$objResponse->call('opinionsFormBtns'); } else { $objResponse->script("alert('{$error}')"); } return $objResponse; }
function page($table, $bid, $pageid, $TotalRows) { global $tpl; $objResponse = new xajaxResponse(); include 'settings/config.php'; include 'settings/tables.php'; include 'settings/template.php'; require_once 'lib/select.php'; require_once 'lib/pagenavi.php'; if ($table == $tbl_blog_comments) { $max_pages = ceil($TotalRows / $set[0]["perpage_comments"]); if (is_numeric($pageid) == false) { if ($pageid == 'first') { $pageid = 1; } if ($pageid == 'last') { $pageid = $max_pages; } } $begin_c = ($pageid - 1) * $set[0]["perpage_comments"]; /* Print :: SELECT :: Comments */ $comments = new SelectEntrys(); $comments->cols = 'id, bid, time, name, comment, lang'; $comments->table = $tbl_blog_comments; $comments->condition = "bid = '{$bid}' AND deleted = '0'"; $comments->order = "time DESC"; $comments->limit = "{$begin_c}, " . $set[0]['perpage_comments']; $comments->multiSelect = 1; //$comments->br = 1; $array_com[] = $comments->row(); unset($comments); /******************************************/ /* Modify Comment Array */ foreach ($array_com as $array_com2) { for ($b = 0; $b < count($array_com2); $b++) { //replace url links $array_com2[$b]['comment'] = str_replace("www.", "http://www.", $array_com2[$b]['comment']); $array_com2[$b]['comment'] = str_replace("http://http://", "http://", $array_com2[$b]['comment']); //$array_com2[$b]['comment'] = preg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" class='postedlink' target='_blank'>\\0</a>", $array_com2[$b]['comment']); //avoid layout damage $array_com2[$b]['comment'] = wordwrap($array_com2[$b]['comment'], 60, " ", 1); //decoding $array_com2[$b]['comment'] = utf8_encode($array_com2[$b]['comment']); //line breaks $array_com2[$b]['comment_unformatted'] = $array_com2[$b]['comment']; $array_com2[$b]['comment'] = nl2br($array_com2[$b]['comment']); } $array_com3[] = $array_com2; } /******************************************/ /* Generate Pagenavi for comments */ $naviObj = new pagenavi(); $naviObj->tableE = $tbl_blog_comments; // required $naviObj->conditionE = "bid = '{$bid}' AND deleted = '0'"; if (is_numeric($pageid) && $pageid <= $max_pages) { if ($TotalRows > $set[0]["perpage_comments"]) { $naviObj->totalrows = $TotalRows; $naviObj->showperpage = $set[0]["perpage_comments"]; $pages_c = $naviObj->rowpages($pageid); // global parameter, defined in config.php } unset($naviObj); } if ($TotalRows == $set[0]['perpage_comments']) { $p_in = "p_cpages_" . $bid; $p_in2 = "p_cpages2_" . $bid; $p_out = "p_page_" . $bid; $p_out2 = "p_page2_" . $bid; $objResponse->remove($p_in); $objResponse->remove($p_in2); $objResponse->assign($p_out, "innerHTML", ' '); $objResponse->assign($p_out2, "innerHTML", ' '); } /******************************************/ /* Generate output */ $tpl->assign('array_com', $array_com3); $tpl->assign('xajax_bid', $bid); $tpl->assign('pages_c', $pages_c); $tpl->assign('blog_id', $bid); $tpl->assign('com_total', $TotalRows); $tpl->assign('page_id', $pageid); $tpl->assign('Myadmin', $Myadmin); $html = $tpl->fetch("pagenavi_ajax.tpl"); $html2 = $tpl->fetch("blog/comments_show.tpl"); $p_name = "p_comments_" . $bid; $p_name2 = "p_cpages_" . $bid; $p_name3 = "p_cpages2_" . $bid; $html4 = $tpl->fetch("blog/comments.tpl"); $objResponse->assign($p_name, "innerHTML", $html2); if ($TotalRows > $set[0]['perpage_comments']) { $objResponse->assign($p_name2, "innerHTML", $html); } if ($TotalRows > $set[0]['perpage_comments']) { $objResponse->assign($p_name3, "innerHTML", $html); } //p_cpages_4 // $objResponse->remove($p_name2); // $objResponse->assign($p_name2,"innerHTML",""); $bullshit = 0; // if ($TotalRows > $set[0]['perpage_comments'] and $bullshit == 0) { $objResponse->assign($p_name2,"innerHTML",$html5); $bullshit =1; } //if ($TotalRows > $set[0]['perpage_comments']) $objResponse->assign($p_name3,"innerHTML",$html); // $objResponse->assign($p_name,"innerHTML",$html2); /******************************************/ } return $objResponse; }
function delete_mount_point($mountPoint) { global $tikilib, $user; $objResponse = new xajaxResponse(); if (!$tikilib->getOne('select mountPoint from el_ice where user = ? and mountPoint = ?', array($user, $mountPoint))) { return $objResponse; } exec(escapeshellcmd("iceWriter.pl delete {$mountPoint}"), $a, $out); if (!$out) { require_once 'lib/elgal/elIce/IceStats.php'; $tikilib->query("delete from el_ice where mountPoint = ?", array($mountPoint)); $objResponse->script('fixedTooltip("Seu ponto de transmissão no EstúdioLivre foi removido com sucesso!")'); $objResponse->remove("ajax-live{$mountPoint}"); } return $objResponse; }
function confirmDeleteActuacion($idActuacion) { global $core; $objResponse = new xajaxResponse(); $sql = "DELETE FROM actuacion WHERE id = '{$idActuacion}'"; if ($core->db->Execute($sql) === false) { $objResponse->alert('Hubo un problema al borrar la información'); } else { $objResponse->alert('El registro fue borrado con exito'); $objResponse->remove('trActuacion' . $idActuacion); } return $objResponse; }