Пример #1
0
function htmlarray_ref(&$a, $exclude = null)
{
    if (!$a) {
        return;
    }
    if (!is_array($a)) {
        $a = htmlspecialchars($a);
        return;
    }
    reset($a);
    if ($exclude && !is_array($exclude)) {
        $exclude = array($exclude);
    }
    foreach ($a as $k => $v) {
        if (is_array($v)) {
            $a[$k] = htmlarray($v, $exclude);
        } elseif (!$exclude) {
            $a[$k] = htmlspecialchars($v);
        } elseif (!in_array($k, $exclude)) {
            $a[$k] = htmlspecialchars($v);
        }
    }
    return;
}
Пример #2
0
    if ($r['prio']) {
        $a[] = $lang->get('priority') . ": {$r['prio']}";
    }
    if ($r['duedate'] != '') {
        $ad = explode('-', $r['duedate']);
        $a[] = $lang->get('due') . ": " . formatDate3(Config::get('dateformat'), (int) $ad[0], (int) $ad[1], (int) $ad[2], $lang);
    }
    if ($r['tags'] != '') {
        $a[] = $lang->get('tags') . ": " . str_replace(',', ', ', $r['tags']);
    }
    if ($r['compl']) {
        $a[] = $lang->get('taskdate_completed') . ": " . timestampToDatetime($r['d_completed']);
    }
    $r['title'] = strip_tags($r['title']);
    $r['note'] = escapeTags($r['note']);
    $r['_descr'] = nl2br($r['note']) . ($a && $r['note'] != '' ? "<br/><br/>" : "") . implode("<br/>", htmlarray($a));
    $data[] = $r;
}
printRss($listData, $data);
function printRss($listData, $data)
{
    $link = get_mttinfo('url') . "?list=" . $listData['id'];
    $buildDate = gmdate('r');
    $s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n<channel>\n" . "<title>{$listData['_feed_title']}</title>\n<link>{$link}</link>\n<description>{$listData['_feed_descr']}</description>\n" . "<lastBuildDate>{$buildDate}</lastBuildDate>\n\n";
    foreach ($data as $v) {
        $d = gmdate('r', $v[$listData['_uid_field']]);
        $guid = $listData['id'] . '-' . $v['id'] . '-' . $v[$listData['_uid_field']];
        $s .= "<item>\n<title><![CDATA[" . str_replace("]]>", "]]]]><![CDATA[>", $v['title']) . "]]></title>\n" . "<link>{$link}</link>\n" . "<pubDate>{$d}</pubDate>\n" . "<description><![CDATA[" . $v['_descr'] . "]]></description>\n" . "<guid isPermaLink=\"false\">{$guid}</guid>\n" . "</item>\n";
    }
    $s .= "</channel>\n</rss>";
    header("Content-type: text/xml; charset=utf-8");
Пример #3
0
function get_mttinfo($v)
{
    global $_mttinfo;
    if (isset($_mttinfo[$v])) {
        return $_mttinfo[$v];
    }
    switch ($v) {
        case 'template_url':
            $_mttinfo['template_url'] = get_mttinfo('mtt_url') . 'themes/' . Config::get('template') . '/';
            return $_mttinfo['template_url'];
        case 'url':
            $_mttinfo['url'] = Config::get('url');
            if ($_mttinfo['url'] == '') {
                $_mttinfo['url'] = 'http://' . $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '') . url_dir(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']);
            }
            return $_mttinfo['url'];
        case 'mtt_url':
            $_mttinfo['mtt_url'] = Config::get('mtt_url');
            if ($_mttinfo['mtt_url'] == '') {
                $_mttinfo['mtt_url'] = url_dir(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']);
            }
            return $_mttinfo['mtt_url'];
        case 'title':
            $_mttinfo['title'] = Config::get('title') != '' ? htmlarray(Config::get('title')) : __('My Tiny Todolist');
            return $_mttinfo['title'];
    }
}
Пример #4
0
function prepareList($row)
{
    $taskview = (int) $row['taskview'];
    return array('id' => $row['id'], 'field_id' => (int) $row['field_id'], 'name' => htmlarray($row['name']), 'sort' => (int) $row['sorting'], 'published' => $row['published'] ? 1 : 0, 'showCompl' => $taskview & 1 ? 1 : 0, 'showNotes' => $taskview & 2 ? 1 : 0, 'hidden' => $taskview & 4 ? 1 : 0);
}
Пример #5
0
 if ($rootpath > 0) {
     if (!$channelfile) {
         $channelfile = "blank.png";
     }
     $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/" . $dirarray[$rootpath]);
     if ($rootpath != 3) {
         $smallimage_select = new XoopsFormSelect('', 'channelfile', $channelfile);
         $smallimage_select->addOptionArray($graph_array);
         $smallimage_select->setExtra("onchange='showImgSelected(\"image\", \"channelfile\", \"" . $dirarray[$rootpath] . "\", \"\", \"" . XOOPS_URL . "\")'");
         $smallimage_tray = new XoopsFormElementTray(_AM_BUTTON, '&nbsp;');
         $smallimage_tray->addElement($smallimage_select);
         $smallimage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/" . $dirarray[$rootpath] . "/" . $channelfile . "' name='image' id='image' alt='' />"));
         $iform->addElement($smallimage_tray);
     } else {
         ob_start();
         htmlarray($htmlfile, XOOPS_ROOT_PATH . "/" . $dirarray[$rootpath]);
         $iform->addElement(new XoopsFormLabel(_AM_CHANHTML, ob_get_contents()));
         ob_end_clean();
     }
     $iform->addElement(new XoopsFormFile(_AM_UPLOADLINKIMAGE, 'uploadfile', $xoopsModuleConfig['maxfilesize']));
     $iform->addElement(new XoopsFormHidden('uploadpath', $dirarray[$rootpath]));
     $iform->addElement(new XoopsFormHidden('rootnumber', $rootpath));
     $dup_tray = new XoopsFormElementTray('', '');
     $dup_tray->addElement(new XoopsFormHidden('op', 'upload'));
     $butt_dup = new XoopsFormButton('', '', _SUBMIT, 'submit');
     $butt_dup->setExtra('onclick="this.form.elements.op.value=\'upload\'"');
     $dup_tray->addElement($butt_dup);
     $butt_dupct = new XoopsFormButton('', '', _AM_DELETE, 'submit');
     $butt_dupct->setExtra('onclick="this.form.elements.op.value=\'delfile\'"');
     $dup_tray->addElement($butt_dupct);
     $iform->addElement($dup_tray);
Пример #6
0
function prepareList($row)
{
    $taskview = (int) $row['taskview'];
    $db = DBConnection::instance();
    $current_user_id = (int) $_SESSION['userid'];
    $notification_id = (int) $db->sq("SELECT id FROM {$db->prefix}notification_listeners WHERE type = 'list' AND value = " . $row['id'] . " AND user_id=" . $current_user_id);
    return array('id' => $row['id'], 'name' => htmlarray($row['name']), 'sort' => (int) $row['sorting'], 'published' => $row['published'] ? 1 : 0, 'showCompl' => $taskview & 1 ? 1 : 0, 'showNotes' => $taskview & 2 ? 1 : 0, 'hidden' => $taskview & 4 ? 1 : 0, 'notification' => $notification_id > 0 ? 1 : 0);
}
Пример #7
0
    } else {
        try {
            $db->ex("CREATE TABLE {$db->prefix}lists (\r\n id INTEGER PRIMARY KEY,\r\n uuid CHAR(36) NOT NULL,\r\n ow INTEGER NOT NULL default 0,\r\n name VARCHAR(50) NOT NULL,\r\n d_created INTEGER UNSIGNED NOT NULL default 0,\r\n d_edited INTEGER UNSIGNED NOT NULL default 0,\r\n sorting TINYINT UNSIGNED NOT NULL default 0,\r\n published TINYINT UNSIGNED NOT NULL default 0,\r\n taskview INTEGER UNSIGNED NOT NULL default 0\r\n) ");
            $db->ex("CREATE UNIQUE INDEX lists_uuid ON {$db->prefix}lists (uuid)");
            $db->ex("CREATE TABLE {$db->prefix}todolist (\r\n id INTEGER PRIMARY KEY,\r\n uuid CHAR(36) NOT NULL,\r\n list_id INTEGER UNSIGNED NOT NULL default 0,\r\n d_created INTEGER UNSIGNED NOT NULL default 0,\r\n d_completed INTEGER UNSIGNED NOT NULL default 0,\r\n d_edited INTEGER UNSIGNED NOT NULL default 0,\r\n compl TINYINT UNSIGNED NOT NULL default 0,\r\n title VARCHAR(250) NOT NULL,\r\n note TEXT,\r\n prio TINYINT NOT NULL default 0,\r\n ow INTEGER NOT NULL default 0,\r\n tags VARCHAR(600) NOT NULL default '',\r\n tags_ids VARCHAR(250) NOT NULL default '',\r\n duedate DATE default NULL\r\n) ");
            $db->ex("CREATE INDEX todo_list_id ON {$db->prefix}todolist (list_id)");
            $db->ex("CREATE UNIQUE INDEX todo_uuid ON {$db->prefix}todolist (uuid)");
            $db->ex("CREATE TABLE {$db->prefix}tags (\r\n id INTEGER PRIMARY KEY AUTOINCREMENT,\r\n name VARCHAR(50) NOT NULL COLLATE NOCASE\r\n) ");
            $db->ex("CREATE UNIQUE INDEX tags_name ON {$db->prefix}tags (name COLLATE NOCASE)");
            $db->ex("CREATE TABLE {$db->prefix}tag2task (\r\n tag_id INTEGER NOT NULL,\r\n task_id INTEGER NOT NULL,\r\n list_id INTEGER NOT NULL\r\n) ");
            $db->ex("CREATE INDEX tag2task_tag_id ON {$db->prefix}tag2task (tag_id)");
            $db->ex("CREATE INDEX tag2task_task_id ON {$db->prefix}tag2task (task_id)");
            $db->ex("CREATE INDEX tag2task_list_id ON {$db->prefix}tag2task (list_id)");
            /* for tagcloud */
        } catch (Exception $e) {
            exitMessage("<b>Error:</b> " . htmlarray($e->getMessage()));
        }
    }
    # create default list
    $db->ex("INSERT INTO {$db->prefix}lists (uuid,name,d_created) VALUES (?,?,?)", array(generateUUID(), 'Todo', time()));
} elseif ($ver == $lastVer) {
    exitMessage("Installed version does not require database update.");
} else {
    if (!in_array($ver, array('1.1', '1.2', '1.3.0', '1.3.1'))) {
        exitMessage("Can not update. Unsupported database version ({$ver}).");
    }
    if (!isset($_POST['update'])) {
        exitMessage("Update database v{$ver}\r\n\t\t<form name=frm method=post><input type=hidden name=update value=1><input type=hidden name=tz value=-1><input type=submit value=' Update '></form>\r\n\t\t<script type=\"text/javascript\">var tz = -1 * (new Date()).getTimezoneOffset(); document.frm.tz.value = tz;</script>\r\n\t\t");
    }
    # update process
    if ($ver == '1.3.1') {
Пример #8
0
    $t = array();
    $t['total'] = 0;
    $count = sizeof($at);
    if (!$count) {
        jsonExit($t);
    }
    $qmax = max($ac);
    $qmin = min($ac);
    if ($count >= 10) {
        $grades = 10;
    } else {
        $grades = $count;
    }
    $step = ($qmax - $qmin) / $grades;
    foreach ($at as $i => $tag) {
        $t['cloud'][] = array('tag' => htmlarray($tag['name']), 'id' => (int) $tag['id'], 'w' => tag_size($qmin, $ac[$i], $step));
    }
    $t['total'] = $count;
    jsonExit($t);
} elseif (isset($_GET['addList'])) {
    check_write_access();
    stop_gpc($_POST);
    $t = addList($db, _post('name'));
    jsonExit($t);
} elseif (isset($_GET['renameList'])) {
    check_write_access();
    stop_gpc($_POST);
    $t = array();
    $t['total'] = 0;
    $id = (int) _post('list');
    $name = str_replace(array('"', "'", '<', '>', '&'), array('', '', '', '', ''), trim(_post('name')));
Пример #9
0
function edittopic($CID = '')
{
    $html = '';
    $smiley = '';
    $xcodes = '';
    $pagetitle = '';
    $pageheadline = '';
    $page = '';
    $breaks = 1;
    $defaultpage = 0;
    $indeximage = '';
    $weight = 1;
    $htmlfile = '';
    $mainpage = 0;
    $submenu = 0;
    $allowcomments = 0;
    global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $XOOPS_URL, $xoopsModuleConfig;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    if ($CID) {
        $result = $xoopsDB->query("SELECT CID,pagetitle, pageheadline, page, weight, html, smiley, xcodes, breaks, defaultpage, indeximage, htmlfile, mainpage, submenu, created, comments, allowcomments  FROM " . $xoopsDB->prefix("wfschannel") . " WHERE CID = {$CID} ");
        list($CID, $pagetitle, $pageheadline, $page, $weight, $html, $smiley, $xcodes, $breaks, $defaultpage, $indeximage, $htmlfile, $mainpage, $submenu, $created, $comments, $allowcomments) = $xoopsDB->fetchrow($result);
        if ($xoopsDB->getRowsNum($result) == 0) {
            redirect_header("index.php", 1, _AM_NOTOPICTOEDIT);
            exit;
        }
        $sform = new XoopsThemeForm(_AM_MODIFYEXSITCHAN, "op", xoops_getenv('PHP_SELF'));
    } else {
        $sform = new XoopsThemeForm(_AM_ADDCHAN, "op", xoops_getenv('PHP_SELF'));
    }
    if (!$indeximage) {
        $indeximage = "blank.png";
    }
    $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig['uploaddir']);
    $indeximage_select = new XoopsFormSelect('', 'indeximage', $indeximage);
    $indeximage_select->addOptionArray($graph_array);
    $indeximage_select->setExtra("onchange='showImgSelected(\"image1\", \"indeximage\", \"" . $xoopsModuleConfig['uploaddir'] . "\", \"\", \"" . XOOPS_URL . "\")'");
    $indeximage_tray = new XoopsFormElementTray(_AM_CHAIMAGE, '&nbsp;');
    $indeximage_tray->addElement($indeximage_select);
    $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/" . $xoopsModuleConfig['uploaddir'] . "/" . $indeximage . "' name='image1' id='image1' alt='' />"));
    $sform->addElement($indeximage_tray);
    $sform->addElement(new XoopsFormText(_AM_CHANW, 'weight', 4, 4, $weight));
    $sform->addElement(new XoopsFormText(_AM_CHANQ, 'pagetitle', 50, 255, $pagetitle), true);
    $sform->addElement(new XoopsFormText(_AM_CHANHDL, 'pageheadline', 50, 255, $pageheadline), false);
    ob_start();
    htmlarray($htmlfile, XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig['htmluploaddir']);
    $sform->addElement(new XoopsFormLabel(_AM_CHANHTML, ob_get_contents()));
    ob_end_clean();
    $sform->addElement(new XoopsFormDhtmlTextArea(_AM_CHANA, 'page', $page, 15, 60), false);
    $html_checkbox = new XoopsFormCheckBox('', 'html', $html);
    $html_checkbox->addOption(1, _AM_DOHTML);
    $sform->addElement($html_checkbox);
    $smiley_checkbox = new XoopsFormCheckBox('', 'smiley', $smiley);
    $smiley_checkbox->addOption(1, _AM_DOSMILEY);
    $sform->addElement($smiley_checkbox);
    $xcodes_checkbox = new XoopsFormCheckBox('', 'xcodes', $xcodes);
    $xcodes_checkbox->addOption(1, _AM_DOXCODE);
    $sform->addElement($xcodes_checkbox);
    $breaks_checkbox = new XoopsFormCheckBox('', 'breaks', $breaks);
    $breaks_checkbox->addOption(1, _AM_BREAKS);
    $sform->addElement($breaks_checkbox);
    $sform->insertBreak("<b>" . _AM_MENU . "</b>", 'bg3');
    $defaultpage_radio = new XoopsFormRadioYN(_AM_DEFAULT, 'defaultpage', $defaultpage, ' ' . _AM_YES . '', ' ' . _AM_NO . '');
    $sform->addElement($defaultpage_radio);
    if ($defaultpage == 0) {
        $submenuitem_radio = new XoopsFormRadioYN(_AM_SUBMENUITEM, 'submenu', $submenu, ' ' . _AM_YES . '', ' ' . _AM_NO . '');
        $sform->addElement($submenuitem_radio);
        $mainpage_radio = new XoopsFormRadioYN(_AM_MAINPAGEITEM, 'mainpage', $mainpage, ' ' . _AM_YES . '', ' ' . _AM_NO . '');
        $sform->addElement($mainpage_radio);
    }
    if (!isset($allowcomments)) {
        $allowcomments = 0;
    }
    $allowcomments_radio = new XoopsFormRadioYN(_AM_ALLOWCOMMENTSCHANHTML, 'allowcomments', $allowcomments, ' ' . _AM_YES . '', ' ' . _AM_NO . '');
    $sform->addElement($allowcomments_radio);
    $sform->addElement(new XoopsFormHidden('CID', $CID));
    $create_tray = new XoopsFormElementTray('', '');
    $create_tray->addElement(new XoopsFormHidden('op', 'save'));
    if (!$CID) {
        $butt_save = new XoopsFormButton('', '', _AM_CREATE, 'submit');
        $butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"');
    } else {
        $butt_save = new XoopsFormButton('', '', _AM_MODIFY, 'submit');
        $butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"');
    }
    $create_tray->addElement($butt_save);
    $butt_cancel = new XoopsFormButton('', '', _AM_CANCEL, 'submit');
    $butt_cancel->setExtra('onclick="this.form.elements.op.value=\'cancel\'"');
    $create_tray->addElement($butt_cancel);
    $sform->addElement($create_tray);
    $sform->display();
    unset($hidden);
}
Пример #10
0
function prepareTaskRow($r, $tz = null)
{
    $dueA = prepare_duedate($r['duedate'], $tz);
    return array('id' => $r['id'], 'title' => htmlarray($r['title']), 'date' => htmlarray($r['d']), 'compl' => (int) $r['compl'], 'prio' => $r['prio'], 'note' => nl2br(htmlarray($r['note'])), 'noteText' => (string) $r['note'], 'ow' => (int) $r['ow'], 'tags' => htmlarray($r['tags']), 'duedate' => $dueA['formatted'], 'dueClass' => $dueA['class'], 'dueStr' => htmlarray($dueA['str']), 'dueInt' => date2int($r['duedate']));
}