Example #1
0
function Lenta_EditFav($msg_id, $priority = 0, $title = "", $action = "edit", $pfx = "CM")
{
    global $session, $stars;
    session_start();
    $user_id = $_SESSION['uid'];
    $objResponse = new xajaxResponse();
    $msg_id = intval($msg_id);
    $GLOBALS['xajax']->setCharEncoding("windows-1251");
    $action = trim($action);
    switch ($action) {
        case "update":
            //$title     = pg_escape_string(substr($title, 0, 128));
            $title = substr($title, 0, 128);
            switch ($pfx) {
                case 'CM':
                    $updatefav = lenta::AddFav($user_id, $msg_id, 0, 0, 0, $priority, $title);
                    $fav_href = "/commune/?id={$editfav['commune_id']}&site=Topic&post={$msg_id}";
                    break;
                case 'PF':
                    $updatefav = lenta::AddFav($user_id, 0, $msg_id, 0, 0, $priority, $title);
                    $fav_href = "/users/{$editfav['login']}/viewproj.php?prjid={$msg_id}";
                    break;
                case 'BL':
                    $updatefav = lenta::AddFav($user_id, 0, 0, $msg_id, 0, $priority, $title);
                    $fav_href = "/blogs/view.php?tr={$msg_id}";
                    break;
            }
            $editfav = lenta::GetFav($user_id, $msg_id, $pfx);
            $key = $msg_id;
            //		    $fav_href =  ( $pfx=='CM' ? "/commune/?id={$editfav['commune_id']}&site=Topic&post={$msg_id}" : "/users/{$editfav['login']}/viewproj.php?prjid={$msg_id}");
            $outHTML = __lentaPrntFavContent($editfav, $key, $user_id, $pfx, $fav_href);
            $objResponse->assign("fav" . $pfx . $msg_id, "innerHTML", $outHTML);
            //		    $objResponse->assign('favstar'.$pfx.$msg_id, "src", "/images/ico_star_{$priority}.gif");
            $objResponse->assign('favstar' . $pfx . $msg_id, "src", "/images/bookmarks/" . $stars[$priority]);
            break;
        case "edit":
            $editfav = lenta::GetFav($user_id, $msg_id, $pfx);
            $editfav['title'] = str_replace("<br/>", "\r\n", reformat2($editfav['title'], 20, 0, 1));
            $outHTML = "<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\"><tbody><tr valign=\"top\"><td style=\"padding-left: 3px;\">";
            $outHTML .= "<ul class=\"post-f-fav-sel\">";
            $outHTML .= "<li><IMG alt=\"\" border=\"0\" id='favpic" . $pfx . $msg_id . "-0' width=\"15\" height=\"15\" src=\"/images/ico_star_0" . ($editfav['priority'] != 0 ? "_empty" : "") . ".gif\" hspace=\"1\" vspace=\"1\" onclick=\"FavPriorityLenta({$msg_id}, 0, '{$pfx}')\" style=\"cursor:pointer;\"></li>";
            $outHTML .= "<li><IMG alt=\"\" border=\"0\" id='favpic" . $pfx . $msg_id . "-1' width=\"15\" height=\"15\" src=\"/images/ico_star_1" . ($editfav['priority'] != 1 ? "_empty" : "") . ".gif\" hspace=\"1\" vspace=\"1\" onclick=\"FavPriorityLenta({$msg_id}, 1, '{$pfx}')\" style=\"cursor:pointer;\"></li>";
            $outHTML .= "<li><IMG alt=\"\" border=\"0\" id='favpic" . $pfx . $msg_id . "-2' width=\"15\" height=\"15\" src=\"/images/ico_star_2" . ($editfav['priority'] != 2 ? "_empty" : "") . ".gif\" hspace=\"1\" vspace=\"1\" onclick=\"FavPriorityLenta({$msg_id}, 2, '{$pfx}')\" style=\"cursor:pointer;\"></li>";
            $outHTML .= "<li><IMG alt=\"\" border=\"0\" id='favpic" . $pfx . $msg_id . "-3' width=\"15\" height=\"15\" src=\"/images/ico_star_3" . ($editfav['priority'] != 3 ? "_empty" : "") . ".gif\" hspace=\"1\" vspace=\"1\" onclick=\"FavPriorityLenta({$msg_id}, 3, '{$pfx}')\" style=\"cursor:pointer;\"></li>";
            $outHTML .= "</ul></td><td>";
            $outHTML .= "<div class=\"fav-one-edit-txt\">";
            $outHTML .= "<INPUT id='favpriority" . $pfx . $msg_id . "' type='hidden' value='" . $editfav['priority'] . "'>";
            $outHTML .= "<INPUT id='currtitle' type='hidden' value='" . $editfav['title'] . "'>";
            $outHTML .= "<textarea rows=\"3\" cols=\"7\" id='favtext" . $pfx . $msg_id . "'>{$editfav['title']}</textarea>";
            $outHTML .= "<div class=\"fav-one-edit-btns\">";
            $outHTML .= "<INPUT type='button' value='Сохранить' onClick='if(document.getElementById(\"favtext" . $pfx . $msg_id . "\").value.length>128){alert(\"Слишком длинное название закладки!\");return false;}else{xajax_Lenta_EditFav(" . $msg_id . ", document.getElementById(\"favpriority" . $pfx . $msg_id . "\").value, document.getElementById(\"favtext" . $pfx . $msg_id . "\").value, \"update\", \"{$pfx}\");}'>";
            $outHTML .= "<INPUT type='button' value='Отмена' onClick='xajax_Lenta_EditFav(" . $msg_id . ", " . $editfav['priority'] . ", document.getElementById(\"currtitle\").value, \"default\", \"{$pfx}\");'>";
            $outHTML .= "</div></td></tr></tbody></table>";
            //$outHTML = "<li class=\"fav-one-edit c\">";
            $outHTML = "<ul class=\"post-f-fav-sel\">";
            $outHTML .= "<li><a href=\"\" onclick=\"FavPriorityLenta({$msg_id}, 0, '{$pfx}'); return false;\"><img src=\"../../images/bookmarks/bsg.png\" alt=\"\" id='favpic" . $pfx . $msg_id . "-0' /></a></li>";
            $outHTML .= "<li><a href=\"\" onclick=\"FavPriorityLenta({$msg_id}, 1, '{$pfx}'); return false;\"><img src=\"../../images/bookmarks/bsgr.png\" alt=\"\" id='favpic" . $pfx . $msg_id . "-1'/></a></li>";
            $outHTML .= "<li><a href=\"\" onclick=\"FavPriorityLenta({$msg_id}, 2, '{$pfx}'); return false;\"><img src=\"../../images/bookmarks/bsy.png\" alt=\"\" id='favpic" . $pfx . $msg_id . "-2'/></a></li>";
            $outHTML .= "<li><a href=\"\" onclick=\"FavPriorityLenta({$msg_id}, 3, '{$pfx}'); return false;\"><img src=\"../../images/bookmarks/bsr.png\" alt=\"\" id='favpic" . $pfx . $msg_id . "-3'/></a></li>";
            $outHTML .= "</ul>";
            $outHTML .= "<div class=\"fav-one-edit-txt\">";
            $outHTML .= "<INPUT id='favpriority" . $pfx . $msg_id . "' type='hidden' value='" . $editfav['priority'] . "'>";
            $outHTML .= "<INPUT id='currtitle' type='hidden' value='" . $editfav['title'] . "'>";
            $outHTML .= "<textarea rows=\"3\" cols=\"7\" id='favtext" . $pfx . $msg_id . "'>{$editfav['title']}</textarea>";
            $outHTML .= "<div class=\"fav-one-edit-btns\"><input type=\"button\" value=\"Сохранить\" onClick='if(document.getElementById(\"favtext" . $pfx . $msg_id . "\").value.length>128){alert(\"Слишком длинное название закладки!\");return false;}else{xajax_Lenta_EditFav(" . $msg_id . ", document.getElementById(\"favpriority" . $pfx . $msg_id . "\").value, document.getElementById(\"favtext" . $pfx . $msg_id . "\").value, \"update\", \"{$pfx}\"); \$(\"fav" . $pfx . $msg_id . "edit\").dispose();}'/> <input type=\"button\" value=\"Отмена\" onClick='xajax_Lenta_EditFav(" . $msg_id . ", " . $editfav['priority'] . ", document.getElementById(\"currtitle\").value, \"default\", \"{$pfx}\"); \$(\"fav" . $pfx . $msg_id . "edit\").dispose();' /></div>";
            $outHTML .= "</div>";
            //$outHTML .= "</li>";
            $objResponse->insertAfter("fav" . $pfx . $msg_id, "li", "fav" . $pfx . $msg_id . "edit");
            $objResponse->assign("fav" . $pfx . $msg_id . "edit", "className", "fav-one-edit");
            $objResponse->assign("fav" . $pfx . $msg_id . "edit", "innerHTML", $outHTML);
            //			$objResponse->assign("fav".$pfx.$msg_id, "innerHTML", $outHTML);
            break;
        default:
            $editfav = lenta::GetFav($user_id, $msg_id, $pfx);
            $key = $msg_id;
            //		    $fav_href =  ( $pfx=='CM' ? "/commune/?id={$editfav['commune_id']}&site=Topic&post={$msg_id}" : "/users/{$editfav['login']}/viewproj.php?prjid={$msg_id}");
            switch ($pfx) {
                case 'CM':
                    $updatefav = lenta::AddFav($user_id, $msg_id, 0, 0, 0, $priority, $title);
                    $fav_href = "/commune/?id={$editfav['commune_id']}&site=Topic&post={$msg_id}";
                    break;
                case 'PF':
                    $updatefav = lenta::AddFav($user_id, 0, $msg_id, 0, 0, $priority, $title);
                    $fav_href = "/users/{$editfav['login']}/viewproj.php?prjid={$msg_id}";
                    break;
                case 'BL':
                    $updatefav = lenta::AddFav($user_id, 0, 0, $msg_id, 0, $priority, $title);
                    $fav_href = "/blogs/view.php?tr={$msg_id}";
                    break;
            }
            $outHTML = __lentaPrntFavContent($editfav, $key, $user_id, $pfx, $fav_href);
            $objResponse->assign("fav" . $pfx . $msg_id, "innerHTML", $outHTML);
            break;
    }
    return $objResponse;
}
Example #2
0
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/blogs.php';
$header = '../header.php';
//$additional_header = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Блоги на Free-lance.ru (".$gr_name.")\" href=\"/rss/blogs.php?gr=".$gr."&amp;t=".$t."\" />";
$css_file = array('lenta.css', 'commune.css', '/css/nav.css');
$content = 'content.php';
$js_file = array('polls.js', 'commune.js');
$footer = '../footer.html';
$user_mod = commune::MOD_ADMIN * hasPermissions('communes');
$user_mod |= commune::MOD_PRO * (users::IsPro($uid, $e) ? 1 : 0);
$user_mod |= commune::MOD_EMPLOYER * (int) is_emp();
$user_mod |= commune::MOD_BANNED * is_banned($uid);
$page = __paramInit('int', 'page', 'page', 1);
$action = __paramInit('string', NULL, 'action');
switch ($action) {
    case 'Save':
        $has_lenta = __paramInit('bool', NULL, 'has_lenta', NULL);
        $my_team = __paramInit('bool', NULL, 'my_team');
        $all_profs = __paramInit('bool', NULL, 'all_profs');
        $communes = __paramInit('array', NULL, 'commune_id');
        $prof_groups = __paramInit('array', NULL, 'prof_group_id');
        if (!lenta::SaveUserSettings($has_lenta, $uid, $my_team, $all_profs, $communes, $prof_groups)) {
        }
        // ошибка.
        header('Location: /lenta/');
        exit;
        break;
    default:
        break;
}
include '../template2.php';
Example #3
0
</li>
                                        <li class="lo-i-u"><?php 
                print __LentaPrntUsrInfo($item, 'user_');
                ?>
</li>
									</ul>
								</div>
                                    <?php 
                break;
        }
        $i++;
    }
    ?>

                    <?php 
    $allThemesCount = lenta::GetLentaThemesCount($cms);
    ?>

                    <script type="text/javascript">

                    var isCtrl = false;
                    var isFocus = false;
                    document.onkeydown = function(e) {
                    	if (!e) e = window.event;
                    	var k = e.keyCode;
                    	if (e.ctrlKey && !isFocus) {
                    		if (k == 13) isCtrl=true;
                    		if (document.getElementById ) {
                    			var d;
                    			if (k == 37) {
                    				obj = document.getElementById('pre_navigation_link1');