Ejemplo n.º 1
0
 public function setProject(Project $project)
 {
     $this->project = $project;
     $url = parent::getUrl();
     $url->setQueryVar('page', 'project');
     $url->setQueryVar('id', $project->getID());
     $this->setContent($project->getName());
 }
Ejemplo n.º 2
0
 private function updateUrl()
 {
     if (count($this->releaseList) > 0) {
         $list = "";
         $first = null;
         foreach ($this->releaseList as $id) {
             if ($first == null) {
                 $first = $id;
             }
             $list .= "," . $id;
         }
         $list = substr($list, 1);
         $url = parent::getUrl();
         $url->setQueryVar('page', 'project');
         $url->setQueryVar('id', $this->projectId);
         $url->setQueryVar('show', $list);
         $url->set(URL_FRAGMENT, $first);
     }
 }
Ejemplo n.º 3
0
function newLinkUrl($url)
{
    $link = new Link($url);
    return $link->getUrl();
}
Ejemplo n.º 4
0
            lcm_setcookie('lcm_lang', $new_lang, time() + 365 * 24 * 3600);
            // Save language preference only if we are installed and if author connected
            if ($valid_author && include_config_exists('inc_connect')) {
                include_lcm('inc_admin');
                lcm_query("UPDATE lcm_author \n\t\t\t\t\t\tSET lang = '" . $new_lang . "' \n\t\t\t\t\t\tWHERE id_author = " . $GLOBALS['author_session']['id_author']);
                $author_session['lang'] = $new_lang;
                lcm_add_session($author_session, $_COOKIE['lcm_session']);
            } else {
                lcm_log("Not valid_author ({$valid_author}) or not yet installed");
            }
            $cible->delvar('lang');
            $cible->addvar('lang', $new_lang);
        } else {
            lcm_log("lcm_set_language() is not happy, wrong lang code?");
        }
    }
}
// Redirection
// Under Apache, cookies with a redirection work
// Else, we do a HTTP refresh
if (ereg("^Apache", $_SERVER['SERVER_SOFTWARE'])) {
    @header("Location: " . $cible->getUrlForHeader());
    exit;
} else {
    @header("Refresh: 0; url=" . $cible->getUrl());
    echo "<html><head>";
    echo "<meta http-equiv='Refresh' content='0; url=" . $cible->getUrl() . "'>";
    echo "</head>\n";
    echo "<body><a href='" . $cible->getUrl() . "'>" . "Redirecting.." . "</a></body></html>";
    exit;
}
Ejemplo n.º 5
0
echo "</select>\n";
echo "<button name=\"submit\" type=\"submit\" value=\"add_client\" class=\"simple_form_btn\">" . 'Add' . "</button>\n";
// TRAD
echo "</td></tr>\n";
echo "</table>\n";
// Delete appointment
if (_session('id_app', 0)) {
    // $checked = ($this->getDataString('hidden') == 'Y' ? ' checked="checked" ' : '');
    $checked = $_SESSION['form_data']['hidden'] == 'Y' ? ' checked="checked" ' : '';
    echo '<p class="normal_text">';
    echo '<input type="checkbox"' . $checked . ' name="hidden" id="box_delete" />';
    echo '<label for="box_delete">' . _T('app_info_delete') . '</label>';
    echo "</p>\n";
}
// Submit buttons
echo '<button name="submit" type="submit" value="adddet" class="simple_form_btn">' . _T('button_validate') . "</button>\n";
echo '<input type="hidden" name="id_app" value="' . _session('id_app', 0) . '" />' . "\n";
echo '<input type="hidden" name="id_case" value="' . _session('id_case', 0) . '" />' . "\n";
echo '<input type="hidden" name="id_followup" value="' . _session('id_followup', 0) . '" />' . "\n";
// because of XHTML validation...
if (_session('ref_edit_app')) {
    $ref_link = new Link(_session('ref_edit_app'));
    echo '<input type="hidden" name="ref_edit_app" value="' . $ref_link->getUrl() . '" />' . "\n";
}
echo "</form>\n";
lcm_page_end();
// Clear the errors, in case user jumps to other 'edit' page
$_SESSION['errors'] = array();
$_SESSION['app_data'] = array();
// DEPRECATED since 0.7.0
$_SESSION['form_data'] = array();
Ejemplo n.º 6
0
 //
 // Time spent on case by authors
 //
 case 'times':
     // List authors on the case
     $show_more_times = _request('more_times') ? true : false;
     $q = "SELECT\n\t\t\t\t\t\ta.id_author, name_first, name_middle, name_last,\n\t\t\t\t\t\tsum(IF(UNIX_TIMESTAMP(fu.date_end) > 0,\n\t\t\t\t\t\t\tUNIX_TIMESTAMP(fu.date_end)-UNIX_TIMESTAMP(fu.date_start), 0)) as time,\n\t\t\t\t\t\tsum(sumbilled) as sumbilled\n\t\t\t\t\tFROM  lcm_author as a, lcm_followup as fu\n\t\t\t\t\tWHERE fu.id_author = a.id_author\n\t\t\t\t\t  AND fu.id_case = {$case}\n\t\t\t\t\t  AND fu.hidden = 'N'\n\t\t\t\t\tGROUP BY fu.id_author";
     $result = lcm_query($q);
     // Show table headers
     echo '<fieldset class="info_box">';
     show_page_subtitle(_T('case_subtitle_times'), 'reports_intro');
     $link_details = new Link();
     $link_details->addVar('more_times', intval(!$show_more_times));
     echo "<table border='0' class='tbl_usr_dtl' width='99%'>\n";
     echo "<tr>\n";
     echo "<th class='heading'>" . _Th('case_input_author') . '&nbsp;' . '<a title="' . _T('fu_button_stats_' . ($show_more_times ? 'less' : 'more')) . '" href="' . $link_details->getUrl() . '">' . '<img src="images/spip/' . ($show_more_times ? 'moins' : 'plus') . '.gif" alt="" border="0" />' . '</a>' . "</th>\n";
     echo "<th class='heading' width='120' nowrap='nowrap' align='right'>" . _Th('time_input_length') . ' (' . _T('time_info_short_hour') . ")</th>\n";
     $total_time = 0;
     $total_sum_billed = 0.0;
     $meta_sum_billed = read_meta('fu_sum_billed');
     if ($meta_sum_billed == 'yes') {
         $currency = read_meta('currency');
         echo "<th class='heading' width='120' nowrap='nowrap' align='right'>" . _Th('fu_input_sum_billed') . ' (' . $currency . ")</th>\n";
     }
     echo "</tr>\n";
     // Show table contents & calculate total
     while ($row = lcm_fetch_array($result)) {
         $total_time += $row['time'];
         $total_sum_billed += $row['sumbilled'];
         echo "<tr><td>";
         echo get_person_name($row);
Ejemplo n.º 7
0
        } else {
            $tmp_link->addVar('show_nokw', "1");
            echo '<p><a href="' . $tmp_link->getUrl() . '" class="run_lnk">' . _T('rep_button_nokw_show') . "</a></p>\n";
        }
    }
    echo '<p><a href="rep_det.php?rep=' . $report->getId() . '" class="run_lnk">' . _T('rep_button_goback') . "</a></p>\n";
    //
    // Make a link to export the report
    //
    echo '<p>';
    $link_csv = new Link();
    $link_csv->delVar('export');
    $link_csv->addVar('export', 'csv');
    echo '<a href="' . $link_csv->getUrl() . '" class="exp_lnk">' . _T('rep_button_exportcsv') . '</a> ';
    $link_ods = new Link();
    $link_ods->delVar('export');
    $link_ods->addVar('export', 'ods');
    echo '<a href="' . $link_ods->getUrl() . '" class="exp_lnk">' . _T('rep_button_exportcsv') . ' (ODS)' . '</a>';
    // TRAD
    echo "</p>\n";
    //
    // Print debug information, if requested
    //
    if (isset($_REQUEST['debug'])) {
        $dbg = $report->getJournal();
        foreach ($dbg as $line) {
            echo $line;
        }
    }
    lcm_page_end();
}
Ejemplo n.º 8
0
$page = PageContent::getInstance();
$page->addComponent(new Title("Zéro fansub", 1));
if (TEST_MODE_ACTIVATED) {
    $options = new SimpleBlockComponent();
    $options->setClass('testFeatures');
    $options->addComponent("Options : ");
    $link = new Link(Url::getCurrentUrl(), "show prepared");
    if ($link->getUrl()->hasQueryVar('showPrepared')) {
        $link->getUrl()->removeQueryVar('showPrepared');
        $link->setClass('reverse');
    } else {
        $link->getUrl()->setQueryVar('showPrepared');
    }
    $options->addComponent($link);
    $link = new Link(Url::getCurrentUrl(), "show old");
    if ($link->getUrl()->hasQueryVar('showOld')) {
        $link->getUrl()->removeQueryVar('showOld');
        $link->setClass('reverse');
    } else {
        $link->getUrl()->setQueryVar('showOld');
    }
    $options->addComponent($link);
    $page->addComponent($options);
}
$page->addComponent($views);
$remaining = 10;
if (Url::getCurrentUrl()->hasQueryVar('showOld')) {
    // TODO display this option or implement pages
    $remaining = -1;
}
foreach ($newsList as $news) {
Ejemplo n.º 9
0
	               <form action="#" method="post">
	                   <input type="hidden" name="id_link" value="<?php 
            echo $_GET['id_link'];
            ?>
" />
	                   <p>
	                       <label for="codigo">Código</label>
	                       <input type="text" disabled="disabled" value="<?php 
            echo $link->getCode();
            ?>
"/>
	                   </p>
	                   <p>
                            <label for="enlace">Enlace: </label>
                            <input id="enlace" type="text" name="enlace" value="<?php 
            echo $link->getUrl();
            ?>
" />
                       </p>
                       <p>
                            <label for="descripcion">Descripción</label>
                            <textarea id="descripcion" name="descripcion"><?php 
            echo $link->getDescription();
            ?>
</textarea>
                       </p>
                       <input type="hidden" name="accion" value="doedit" />
                       <input type="submit" value="Guardar">
	               </form>
	            <?php 
        } elseif ($_GET['accion'] == 'delete') {
Ejemplo n.º 10
0
$headers[2]['title'] = _Th('authoredit_input_status');
$headers[2]['order'] = 'order_status';
show_list_start($headers);
for ($i = 0; $i < $prefs['page_rows'] && ($row = lcm_fetch_array($result)); $i++) {
    echo "<tr>\n";
    echo '<td class="tbl_cont_' . ($i % 2 ? "dark" : "light") . '">';
    echo '<input type="checkbox" name="authors[]" value="' . $row['id_author'] . '" />';
    echo "</td>\n";
    echo '<td class="tbl_cont_' . ($i % 2 ? "dark" : "light") . '">' . get_person_name($row) . "</td>\n";
    echo '<td class="tbl_cont_' . ($i % 2 ? "dark" : "light") . '">' . _T('authoredit_input_status_' . $row['status']) . "</td>\n";
    echo "</tr>\n";
}
show_list_end($list_pos, $number_of_rows);
?>

<input type="hidden" name="case" value="<?php 
echo $case;
?>
" />
<input type="hidden" name="ref_sel_auth" value="<?php 
echo $dest_link->getUrl();
?>
" />
<button name="submit" type="submit" value="submit" class="simple_form_btn"><?php 
echo _T('button_validate');
?>
</button>
</form>

<?php 
lcm_page_end();
Ejemplo n.º 11
0
function show_login($cible, $prive = 'prive', $message_login = '')
{
    $error = '';
    $login = _request('var_login');
    $logout = _request('var_logout');
    // If the cookie fails, inc_auth tried to redirect to lcm_cookie who
    // then tried to put a cookie. If it is not there, it is "cookie failed"
    // who is there, and it's probably a bookmark on privet=yes and not
    // a cookie failure.
    $cookie_failed = "";
    if (_request('var_cookie_failed')) {
        $cookie_failed = $_COOKIE['lcm_session'] != 'cookie_test_failed';
    }
    global $author_session;
    global $lcm_session;
    global $clean_link;
    if (!$cible) {
        // cible = destination
        $cible = new Link(_request('var_url', 'index.php'));
    }
    $cible->delVar('var_erreur');
    $cible->delVar('var_url');
    $cible->delVar('var_cookie_failed');
    $clean_link->delVar('var_erreur');
    $clean_link->delVar('var_login');
    $clean_link->delVar('var_cookie_failed');
    $url = $cible->getUrl();
    // This populates the $author_session variable
    include_lcm('inc_session');
    verifier_visiteur();
    if ($author_session and !$logout and ($author_session['status'] == 'admin' or $author_session['status'] == 'normal')) {
        if ($url != $GLOBALS['clean_link']->getUrl()) {
            lcm_header("Location: " . $cible->getUrlForHeader());
        }
        // [ML] This is making problems for no reason, we use login only
        // for one mecanism (entering the system).
        // echo "<a href='$url'>"._T('login_this_way')."</a>\n";
        echo "<a class='content_link' href='index.php'>" . _T('login_this_way') . "</a>\n";
        return;
    }
    if (_request('var_erreur') == 'pass') {
        $error = _T('login_password_incorrect');
    }
    // The login is memorized in the cookie for a possible future admin login
    if (!$login && isset($_COOKIE['lcm_admin'])) {
        if (preg_match("/^@(.*)\$/", $_COOKIE['lcm_admin'], $regs)) {
            $login = $regs[1];
        }
    } else {
        if ($login == '-1') {
            $login = '';
        }
    }
    // other sources for authentication
    $flag_autres_sources = isset($GLOBALS['ldap_present']) ? $GLOBALS['ldap_present'] : '';
    // What informations to pass?
    if ($login) {
        $status_login = 0;
        // unknown status
        $login = clean_input($login);
        $query = "SELECT id_author, status, password, prefs, alea_actuel, alea_futur \n\t\t\t\t\tFROM lcm_author \n\t\t\t\t\tWHERE username='******'";
        $result = lcm_query($query);
        if ($row = lcm_fetch_array($result)) {
            if ($row['status'] == 'trash' or $row['password'] == '') {
                $status_login = -1;
                // deny
            } else {
                $status_login = 1;
                // known login
                // Which infos to pass for the javascript ?
                $id_author = $row['id_author'];
                $alea_actuel = $row['alea_actuel'];
                // for MD5
                $alea_futur = $row['alea_futur'];
                // Button for lenght of connection
                if ($row['prefs']) {
                    $prefs = unserialize($row['prefs']);
                    $rester_checked = $prefs['cnx'] == 'perma' ? ' checked=\'checked\'' : '';
                }
            }
        }
        // Unknown login (except LDAP) or refused
        if ($status_login == -1 or $status_login == 0 and !$flag_autres_sources) {
            $error = _T('login_identifier_unknown', array('login' => htmlspecialchars(clean_output($login))));
            $login = '';
            // [ML] Not sure why this was here, but headers are already sent
            // therefore it causes an error message (which is not shown, but
            // might make a mess, knowing how PHP runs differently everywhere..)
            // @lcm_setcookie('lcm_admin', '', time() - 3600);
        }
    }
    // Javascript for the focus
    if ($login) {
        $js_focus = 'document.form_login.session_password.focus();';
    } else {
        $js_focus = 'document.form_login.var_login.focus();';
    }
    // [ML] we should probably add a help link here, since tech, but let's see
    // how many users complain first, since this should affect only tech users
    if ($cookie_failed == "yes") {
        $error = _T('login_warning_cookie');
    }
    echo open_login();
    // [ML] Looks like there is no reason why to use $clean_link (defined in inc_version.php)
    // It would cause very strange bugs when the "feed_globals()" were removed from inc_version
    // and in the end, well, it looks rather useless.
    //
    // Strange bugs were caused because $action would be "./" and therefore it
    // would call index.php -> listcases.php -> includes inc_auth.php who then
    // calls auth(), who redirects to the login page.
    $action = $clean_link->getUrl();
    // $action = "lcm_login.php";
    if ($login) {
        // Shows the login form, including the MD5 javascript
        $flag_challenge_md5 = true;
        if ($flag_challenge_md5) {
            echo '<script type="text/javascript" src="inc/md5.js"></script>';
        }
        echo "\n";
        echo '<form name="form_login" action="lcm_cookie.php" method="post"';
        if ($flag_challenge_md5) {
            echo " onsubmit='if (this.session_password.value) {\n\t\t\t\tthis.session_password_md5.value = calcMD5(\"{$alea_actuel}\" + this.session_password.value);\n\t\t\t\tthis.next_session_password_md5.value = calcMD5(\"{$alea_futur}\" + this.session_password.value);\n\t\t\t\tthis.session_password.value = \"\"; }'";
        }
        echo ">\n";
        echo "<div class='main_login_box' style='text-align:" . $GLOBALS["lcm_lang_left"] . ";'>\n";
        if ($error) {
            echo "<div style='color:red;'><b>" . _T('login_access_denied') . " {$error}</b></div><br />\n";
        }
        if ($flag_challenge_md5) {
            // This is printed with javascript so that it is hidden from navigators not
            // using JS, since they will see the username field anyway.
            echo "<script type=\"text/javascript\"><!--\n" . "document.write('" . addslashes(_T('login_login')) . " <b>{$login}</b><br/>" . "<font size=\\'2\\'><a href=\\'lcm_cookie.php?cookie_admin=no&amp;url=" . rawurlencode($action) . "\\' class=\\'link_btn\\'>" . _T('login_other_identifier') . "</a></font>');\n" . "//--></script>\n";
            // If javascript is active, we pass the login in the hidden field
            echo "<input type='hidden' name='session_login_hidden' value='{$login}' />";
            // If javascript is not active, the login is still modifiable
            // (since the challenge is not used)
            echo "<noscript>";
        }
        echo "\t<label for='session_login'><b>" . _T('login_login') . "</b> (" . _T('login_info_login') . ")<br /></label>";
        echo "\t<input type='text' name='session_login' id='session_login' class='forml' value=\"{$login}\" size='40' />\n";
        if ($flag_challenge_md5) {
            echo "</noscript>\n";
        }
        echo "\t<p />\n";
        echo "\t<label for='session_password'><b>" . _T('login_password') . "</b><br /></label>";
        echo "\t<input type='password' name='session_password' id='session_password' class='forml' value=\"\" size='40' />\n";
        echo "\t<input type='hidden' name='essai_login' value='oui' />\n";
        echo "\t<br />&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='session_remember' value='yes' id='session_remember'{$rester_checked} /> ";
        echo "\t<label for='session_remember'>" . _T('login_remain_logged_on') . "</label>";
        echo "\t<input type='hidden' name='url' value='{$url}' />\n";
        echo "\t<input type='hidden' name='session_password_md5' value='' />\n";
        echo "\t<input type='hidden' name='next_session_password_md5' value='' />\n";
        echo "<div align='right'><input class='button_login' type='submit' value='" . _T('button_validate') . "' /></div>\n";
        echo "</div>";
        echo "</form>";
    } else {
        // Ask only for the login/username
        $action = quote_amp($action);
        echo "<form name='form_login' action='{$action}' method='post'>\n";
        echo "<div class='main_login_box' style='text-align:" . $GLOBALS["lcm_lang_left"] . ";'>";
        if ($error) {
            echo "<span style='color:red;'><b>" . _T('login_access_denied') . " {$error}</b></span><p />";
        }
        echo "<label><b>" . _T('login_login') . '</b> (' . _T('login_info_login') . ')' . "<br /></label>";
        echo "<input type='text' name='var_login' class='forml' value=\"\" size='40' />\n";
        echo "<input type='hidden' name='var_url' value='{$url}' />\n";
        echo "<div align='right'><input class='button_login' type='submit' value='" . _T('button_validate') . "' /></div>\n";
        echo "</div>";
        echo "</form>";
    }
    // Focus management
    echo "<script type=\"text/javascript\"><!--\n" . $js_focus . "\n//--></script>\n";
    // Start the login footer
    echo "<div align='left' style='font-size: 12px;' >";
    echo "<div class='lang_combo_box'>" . menu_languages() . "</div>\n";
    // button for "forgotten password"
    include_lcm('inc_mail');
    if (server_can_send_email()) {
        echo '<a href="lcm_pass.php?pass_forgotten=yes" target="lcm_pass" onclick="' . "javascript:window.open(this.href, 'lcm_pass', 'scrollbars=yes, resizable=yes, width=640, height=280'); return false;\" class=\"link_btn\">" . _T('login_password_forgotten') . '</a>';
    }
    $register_popup = 'href="lcm_pass.php?register=yes" target="lcm_pass" ' . ' onclick="' . "javascript:window.open('lcm_pass.php?register=yes', 'lcm_pass', 'scrollbars=yes, resizable=yes, width=640, height=500'); return false;\"";
    $open_subscription = read_meta("site_open_subscription");
    if ($open_subscription == 'yes' || $open_subscription == 'moderated') {
        echo "&nbsp;&nbsp;&nbsp;<a {$register_popup} class=\"link_btn\">" . _T('login_register') . '</a>';
    }
    echo "</div>\n";
    echo close_login();
}
Ejemplo n.º 12
0
 /**
  * @before _verified
  */
 public function createLink()
 {
     $this->JSONView();
     $view = $this->getActionView();
     $adid = RM::post("adid");
     if (!$adid) {
         return $view->set('message', "Invalid Request");
     }
     $ad = \Ad::first(["_id = ?" => $adid, "live = ?" => true], ['_id', 'title']);
     if (!$ad) {
         return $view->set('message', "Invalid Request");
     }
     $user = User::first(["id = ?" => RM::post("aff_id")]) ?? $this->user;
     $tdomains = Shared\Services\User::trackingLinks($user, $this->org);
     if (RM::post("domain")) {
         $domain = RM::post("domain");
     } else {
         $domain = $this->array_random($tdomains);
     }
     $link = Link::first(["ad_id = ?" => $ad->_id, "user_id = ?" => $user->_id], ['domain', '_id']);
     if (!$link) {
         $link = new Link(['user_id' => $user->_id, 'ad_id' => $ad->_id, 'domain' => $domain, 'live' => true]);
         $link->save();
     }
     $view->set('message', $ad->title)->set('link', $link->getUrl($domain));
 }
Ejemplo n.º 13
0
<?php

$page = PageContent::getInstance();
$page->setClass("havert");
$page->addComponent(new Title("Avertissement", 1));
$page->addComponent(new Image("images/news/avert.jpg"));
$page->addComponent(new Title("Vous êtes sur le point d'entrer en mode Hentaï", 2));
$page->addComponent(new SimpleParagraphComponent("Comme son nom l'indique, vous vous apprêtez à regarder plein de machins dégoûtants interdits aux enfants. Mais bon, si vous êtes majeur, vacciné et consentant, on vous y autorise."));
$okLink = new Link();
$okLink->setContent("Montrer les machins dégoutants");
$url = $okLink->getUrl();
$url->removeQueryVar(DISPLAY_H_AVERT);
$url->setQueryVar(MODE_H, true);
$page->addComponent($okLink);
$cancelLink = new Link(Url::indexUrl(), "Garder mon écran propre");
if (isset($_SERVER["HTTP_REFERER"])) {
    // TODO if the referer is a page needing the H mode, do not use it
    $cancelLink->setUrl(new Url($_SERVER["HTTP_REFERER"]));
}
$page->addComponent($cancelLink);
Ejemplo n.º 14
0
 public function __construct($link)
 {
     parent::__construct('save');
     $language = OW::getLanguage()->getInstance();
     $this->link = $link;
     $urlField = new TextField('url');
     $urlField->setHasInvitation(true)->setInvitation('http://www.example.com');
     $this->addElement($urlField->setRequired(true)->addValidator(new UrlValidator())->setLabel($language->text('links', 'save_form_url_field_label'))->setValue($this->link->getUrl()));
     $titleField = new TextField('title');
     $this->addElement($titleField->setRequired(true)->setLabel($language->text('links', 'save_form_title_field_label'))->setValue($this->link->getTitle()));
     $descriptionTextArea = new WysiwygTextarea('description');
     $descriptionTextArea->setLabel($language->text('links', 'save_form_desc_field_label'));
     $descriptionTextArea->setValue($this->link->getDescription());
     $descriptionTextArea->setRequired(true);
     $this->addElement($descriptionTextArea);
     $tagService = BOL_TagService::getInstance();
     $tags = array();
     if (intval($this->link->getId()) > 0) {
         $arr = $tagService->findEntityTags($this->link->getId(), 'link');
         foreach (!empty($arr) ? $arr : array() as $dto) {
             $tags[] = $dto->getLabel();
         }
     }
     $tagsField = new TagsInputField('tags');
     $tagsField->setLabel($language->text('links', 'save_form_tags_field_label'));
     $tagsField->setValue($tags);
     $tagsField->setDelimiterChars(array('.'));
     $this->addElement($tagsField);
     //        $tagsField = new TagsField('tags', $tags);
     //        $this->addElement($tagsField->setLabel($language->text('links', 'save_form_tags_field_label')));
     $submit = new Submit('submit');
     $this->addElement($submit);
 }
Ejemplo n.º 15
0
function show_list_end($current_pos = 0, $number_of_rows = 0, $allow_show_all = false, $prefix = '')
{
    global $prefs;
    $prefix_var = $prefix ? $prefix . '_' : '';
    echo "</table>\n";
    //
    // Navigation for previous/next screens
    //
    $list_pages = ceil($number_of_rows / $prefs['page_rows']);
    if (!$list_pages) {
        echo "<!-- list_pages == 0 -->\n";
        return;
    }
    $link = new Link();
    $pos = $link->getVar($prefix_var . 'list_pos');
    $link->delVar($prefix_var . 'list_pos');
    // If we are showing "All" items, do not show navigation
    if ($pos == 'all') {
        return '';
    }
    echo "<table border='0' align='center' width='99%' class='page_numbers'>\n";
    echo '<tr><td align="left" width="15%">';
    // Previous page
    if ($current_pos > 0) {
        if ($current_pos > $prefs['page_rows']) {
            $link->addVar($prefix_var . 'list_pos', $current_pos - $prefs['page_rows']);
        }
        echo '<a href="' . $link->getUrl($prefix) . '" class="content_link">' . "&lt; " . _T('listnav_link_previous') . '</a> ';
    }
    echo "</td>\n";
    echo '<td align="center" width="70%">';
    // Page numbers with direct links
    if ($list_pages > 1) {
        echo _T('listnav_link_gotopage') . ' ';
        for ($i = 0; $i < $list_pages; $i++) {
            if ($i == floor($current_pos / $prefs['page_rows'])) {
                echo '[' . ($i + 1) . '] ';
            } else {
                $current_pos_val = $i * $prefs['page_rows'];
                $link = new Link();
                $link->delVar($prefix_var . 'list_pos');
                if ($current_pos_val > 0) {
                    $link->addVar($prefix_var . 'list_pos', $current_pos_val);
                }
                echo '<a href="' . $link->getUrl($prefix) . '" class="content_link">' . ($i + 1) . '</a> ';
            }
        }
        if ($allow_show_all) {
            $link->delVar($prefix_var . 'list_pos');
            $link->addVar($prefix_var . 'list_pos', 'all');
            echo '<a href="' . $link->getUrl($prefix) . '" class="content_link">' . _T('listnav_link_show_all') . '</a>';
        }
    }
    echo "</td>\n";
    echo "<td align='right' width='15%'>";
    // Next page
    $next_pos = $current_pos + $prefs['page_rows'];
    if ($next_pos < $number_of_rows) {
        $current_pos_val = $next_pos;
        $link = new Link();
        $link->addVar($prefix_var . 'list_pos', $current_pos_val);
        echo '<a href="' . $link->getUrl($prefix) . '" class="content_link">' . _T('listnav_link_next') . " &gt;" . '</a>';
    }
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
}
Ejemplo n.º 16
0
 public function addLink($url)
 {
     $link = new Link();
     // On tente de charger le lien
     try {
         $link->load($url);
     } catch (Exception $e) {
         return "false";
     }
     /* --- Database --- */
     $subjectId = $this->subjectId($link->getSubjectName());
     if ($subjectId == false) {
         $subjectId = $this->addSubject($link->getSubjectName());
     }
     $query = "INSERT INTO link(link, name, subject_id) VALUES(\$\$" . pg_escape_string($link->getUrl()) . "\$\$, \$\$" . pg_escape_string($link->getName()) . "\$\$, " . pg_escape_string($subjectId) . ")";
     try {
         pg_query($query);
     } catch (Exception $e) {
         return "false";
     }
     if ($link != false) {
         $arr = array('link' => $link->getUrl(), 'name' => $link->getName(), 'subject_id' => $this->subjectId($link->getSubjectName()));
         return json_encode($arr);
     } else {
         return "false";
     }
     dbClose($db);
 }
Ejemplo n.º 17
0
function print_registration_form()
{
    install_html_start(_T('pass_title_register'), 'login');
    $link = new Link();
    $url = $link->getUrl();
    echo '<p align="left" class="normal_text">' . _T('pass_info_why_register') . "</p>\n";
    echo show_all_errors();
    echo "<form method='post' action='{$url}' style='border: 0px; margin: 0px;'>\n";
    echo '<input type="hidden" name="register" value="data" />' . "\n";
    echo "<fieldset><label><b>" . _T('info_your_contact_information') . "</b><br></label>\n";
    // [ML] Altough not most problematic, could be better. But if someone
    // fixes here, please fix install.php also (step 4)
    echo "<table border='0'>\n";
    echo "<tr>\n";
    echo "<td>\n\t\t\t<label for='name_first'>" . f_err_star('name_first') . _Ti('person_input_name_first') . "</label><br />\n\t\t\t<input type='text' style='width: 100%;' id='name_first' name='name_first' class='formo' value='" . _session('name_first') . "' size='20'>\n\t\t</td>\n";
    echo "<td>\n\t\t\t<label for='name_last'>" . f_err_star('name_last') . _Ti('person_input_name_last') . "</label><br />\n\t\t\t<input type='text' style='width: 100%;' id='name_last' name='name_last' class='formo' value='" . _session('name_last') . "' size='20'>\n\t\t</td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "<td colspan='2'>";
    echo "<p><label for='email'>" . f_err_star('email') . _Ti('input_email') . "</label><br />";
    echo "<input type='text' id='email' name='email' class='formo' value='" . _session('email') . "' size='40'></p>\n";
    echo "<p><label for='username'>" . f_err_star('username') . _Ti('authoredit_input_username') . "</label> ";
    echo "<small>" . _T('info_more_than_three') . "</small><br />";
    echo "<input type='text' id='username' name='username' class='formo' value='" . _session('username') . "' size='40'></p>\n";
    echo "<small>" . _T('pass_info_password_by_mail') . "</small>\n";
    echo "</fieldset>\n";
    echo "<p align=\"right\">";
    echo '<button type="submit" name="Validate">' . _T('button_validate') . "</button>";
    echo "</p>";
    echo "</form>\n";
    $_SESSION['form_data'] = array();
    $_SESSION['errors'] = array();
}
Ejemplo n.º 18
0
     $link->setClass('reverse');
 } else {
     $link->getUrl()->setQueryVar('phpinfo');
 }
 $features->addComponent($link);
 $link = new Link(Url::getCurrentUrl(), 'Go in the future');
 if (Url::getCurrentUrl()->hasQueryVar('setdate')) {
     $link->getUrl()->removeQueryVar('setdate');
     $link->setClass('reverse');
 } else {
     $link->getUrl()->setQueryVar('setdate', PHP_INT_MAX);
 }
 $features->addComponent($link);
 $link = new Link(Url::getCurrentUrl(), 'deactivate testing mode');
 if (Url::getCurrentUrl()->hasQueryVar('noTest')) {
     $link->getUrl()->removeQueryVar('noTest');
     $link->setClass('reverse');
 } else {
     $link->getUrl()->setQueryVar('noTest');
 }
 $features->addComponent($link);
 $features->addComponent('<br/>');
 $features->addComponent(date("Y-m-d H:i:s", $_SESSION[CURRENT_TIME]));
 $features->addComponent('<br/>');
 $branches = array();
 exec('git branch', $branches);
 foreach ($branches as $branch) {
     if (preg_match("#^\\* .*\$#", $branch)) {
         $features->addComponent(substr($branch, 2));
         break;
     }
Ejemplo n.º 19
0
function show_author_form($tab)
{
    global $author_session;
    global $prefs;
    // Referer not always set (bookmark, reload, etc.)
    // [AG] This is to preserve page's referer in 'ref' GET value during tab transitions
    // giving it higher priority than the actual page referer
    if (isset($_GET['ref'])) {
        $http_ref = urldecode(clean_input($_GET['ref']));
    } else {
        $http_ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
    }
    $http_ref_link = new Link($http_ref);
    echo '<form name="upd_user_profile" method="post" action="config_author.php">' . "\n";
    echo '<input type="hidden" name="referer" value="' . $http_ref_link->getUrl() . '" />' . "\n";
    echo '<input type="hidden" name="author_' . ($tab == 'advanced' ? 'advanced_settings' : 'ui') . '_modified" value="yes" />' . "\n";
    if ($tab == 'advanced') {
        echo '<input type="hidden" name="tab" value="1" />' . "\n";
    }
    echo '<table width="99%" border="0" align="center" cellpadding="5" cellspacing="0" class="tbl_usr_dtl">' . "\n";
    echo "<tr>\n";
    echo '<td colspan="2" align="center" valign="middle" class="heading">';
    echo '<h4>' . _T('authorconf_subtitle_' . $tab) . "</h4></td>\n";
    echo "</tr>\n";
    switch ($tab) {
        //
        // User interface
        //
        case 'interface':
            if ($GLOBALS['all_langs']) {
                echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align=\"right\" valign=\"top\">" . _T('authorconf_input_language') . "</td>\n\t\t\t\t\t<td align=\"left\" valign=\"top\">\n\t\t\t\t\t<input type='hidden' name='old_language' value='" . $GLOBALS['lcm_lang'] . "'/>\n";
                echo menu_languages('sel_language');
                echo "\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n";
            }
            ?>
	    <tr>
	    	<td align="right" valign="top" width="50%"><?php 
            echo _T('authorconf_input_screen');
            ?>
</td>
			<td align="left" valign="top">
				<input type="hidden" name="old_screen" id="old_screen" value="<?php 
            echo $prefs['screen'];
            ?>
" />
				<select name="sel_screen" class="sel_frm">
<?php 
            $screen_modes = array("wide", "narrow");
            foreach ($screen_modes as $scrm) {
                $selected_mode = $scrm == $prefs['screen'] ? " selected='selected'" : '';
                echo "<option value='" . $scrm . "'" . $selected_mode . ">" . _T('authorconf_input_screen_' . $scrm) . "</option>\n";
            }
            ?>
				</select>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top"><?php 
            echo _T('authorconf_input_theme');
            ?>
</td>
			<td align="left" valign="top">
				<input type="hidden" name="old_theme" id="old_theme" value="<?php 
            echo $prefs['theme'];
            ?>
" />
				<select name="sel_theme" class="sel_frm" id="sel_theme">
<?php 
            $themes = get_theme_list();
            foreach ($themes as $t) {
                // If a theme has no translation, show only the file name
                $name = _T('authorconf_input_theme_' . $t);
                if ($name == 'authorconf_input_theme_' . $t) {
                    $name = $t;
                }
                $selected = $t == $prefs['theme'] ? " selected='selected'" : '';
                echo "<option value='" . $t . "'" . $selected . ">" . $name . "</option>\n";
            }
            ?>
				</select>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top"><?php 
            echo _T('authorconf_input_font_size');
            ?>
</td>
			<td align="left" valign="top">

				<input type="hidden" name="old_font_size" id="old_font_size" value="<?php 
            echo $prefs['font_size'];
            ?>
" />
				<!-- <input name="inc_fnt" type="button" class="search_form_btn" id="inc_fnt" value="A -" />
                &nbsp; <input name="dec_fnt" type="button" class="search_form_btn" id="dec_fnt" value="A +" / >
				(not working yet) -->
				<select name="font_size" class="sel_frm" onchange="setActiveStyleSheet(document.upd_user_profile.font_size.options[document.upd_user_profile.font_size.options.selectedIndex].value)">

				<?php 
            $fonts = array('small_font', 'medium_font', 'large_font');
            // font_size gets default value in inc_auth.php
            foreach ($fonts as $f) {
                $sel = $f == $prefs['font_size'] ? 'selected="selected" ' : '';
                echo '<option ' . $sel . 'value="' . $f . '">' . _T('authorconf_input_' . $f) . '</option>' . "\n";
            }
            ?>

				</select>
			</td>
		</tr>
		<tr>
			<td align="right" valign="top"><?php 
            echo _T('authorconf_input_results_per_page');
            ?>
</td>
			<td align="left" valign="top">
				<input type="hidden" name="old_page_rows" id="old_page_rows" value="<?php 
            echo $prefs['page_rows'];
            ?>
" /> 
				<input name="page_rows" type="text" class="search_form_txt" id="page_rows" size="3" value="<?php 
            // page_rows gets default value in inc_auth.php
            echo $prefs['page_rows'];
            ?>
" />
			</td>
		</tr>
	</table>
<?php 
            break;
            //
            // Advanced settings
            //
        //
        // Advanced settings
        //
        case 'advanced':
            // Absolute/relative time intervals setting
            echo "<tr>\n";
            echo '<td align="left" valign="top">' . _T('authorconf_input_ui_time') . "</td>\n";
            echo '<td align="left" valign="top">' . '<input type="hidden" name="old_time_intervals" id="old_time_intervals" value="' . $prefs['time_intervals'] . '" />' . '<select name="sel_time_intervals" class="sel_frm">';
            $time_intervals = array("absolute", "relative");
            foreach ($time_intervals as $ti) {
                echo '<option value="' . $ti . '"' . isSelected($ti == $prefs['time_intervals']) . '>' . _T('authorconf_input_time_interval_' . $ti) . "</option>\n";
            }
            echo "</select>\n";
            echo "</td>\n";
            echo "</tr>\n";
            // Relative time intervals notation setting (hours only / float days,hours,minutes / float days, float hours, minutes)
            echo "<tr>\n";
            echo '<td align="left" valign="top">' . _T('authorconf_input_time_intervals_notation') . "</td>\n";
            echo '<td align="left" valign="top">' . '<input type="hidden" name="old_time_intervals_notation" id="old_time_intervals_notation" value="' . $prefs['time_intervals_notation'] . '" />' . '<select name="sel_time_intervals_notation" class="sel_frm">';
            $time_intervals_notation = array("hours_only", "floatdays_hours_minutes");
            foreach ($time_intervals_notation as $tin) {
                echo "<option value='" . $tin . "'" . isSelected($tin == $prefs['time_intervals_notation']) . ">" . _T('authorconf_input_time_intervals_notation_' . $tin) . "</option>\n";
            }
            echo "</select>\n";
            echo "</td>\n";
            echo "</tr>\n";
            echo "</table>\n";
            break;
    }
    // Submit button
    echo '<p align="' . $GLOBALS['lcm_lang_left'] . '">';
    echo '<input name="validate" type="submit" class="search_form_btn" id="submit" value="' . _T('authorconf_button_update_preferences') . '" />';
    echo "</p>\n";
    echo "</form>\n";
}
Ejemplo n.º 20
0
 public static function CreateHentaiAccessLink($toHentaiString = "Hentaï", $toEveryoneString = "Tout public")
 {
     $hentaiLink = new Link();
     $url = $hentaiLink->getUrl();
     if ($_SESSION[MODE_H] == false) {
         $url->setQueryVar(DISPLAY_H_AVERT);
         $hentaiLink->setContent($toHentaiString);
     } else {
         $url->setQueryVar(MODE_H, false);
         $hentaiLink->setContent($toEveryoneString);
     }
     return $hentaiLink;
 }
Ejemplo n.º 21
0
function auth()
{
    global $INSECURE, $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_COOKIE_VARS, $REMOTE_USER, $PHP_AUTH_USER, $PHP_AUTH_PW;
    global $auth_can_disconnect;
    global $connect_id_auteur, $connect_nom, $connect_bio, $connect_email;
    global $connect_nom_site, $connect_url_site, $connect_login, $connect_pass;
    global $connect_activer_imessage, $connect_activer_messagerie;
    global $connect_status;
    global $author_session, $prefs;
    global $clean_link;
    // This reloads $GLOBALS['db_ok'], just in case
    include_config('inc_connect');
    // If there is not SQL connection, quit.
    if (!$GLOBALS['db_ok']) {
        include_lcm('inc_presentation');
        lcm_html_start("Technical problem", "install");
        // annoy sql_errno()
        echo "\n<!-- \n";
        echo "\t* Flag connect: " . $GLOBALS['flag_connect'] . "\n\t";
        lcm_query("SELECT count(*) from lcm_meta");
        echo "\n-->\n\n";
        echo "<div align='left' style='width: 600px;' class='box_error'>\n";
        echo "\t<h3>" . _T('title_technical_problem') . "</h3>\n";
        echo "\t<p>" . _T('info_technical_problem_database') . "</p>\n";
        if (lcm_sql_errno()) {
            echo "\t<p><tt>" . lcm_sql_errno() . " " . lcm_sql_error() . "</tt></p>\n";
        } else {
            echo "\t<p><tt>No error diagnostic was provided.</tt></p>\n";
        }
        echo "</div>\n";
        lcm_html_end();
        return false;
    }
    // Initialise variables (avoid URL hacks)
    $auth_login = "";
    $auth_pass = "";
    $auth_pass_ok = false;
    $auth_can_disconnect = false;
    // Fetch identification data from authentication session
    if (isset($_COOKIE['lcm_session'])) {
        if (verifier_session($_COOKIE['lcm_session'])) {
            if ($author_session['status'] == 'admin' or $author_session['status'] == 'normal') {
                $auth_login = $author_session['username'];
                $auth_pass_ok = true;
                $auth_can_disconnect = true;
            }
        }
    } else {
        if ($_REQUEST['privet'] == 'yes') {
            // Failed login attempt: cookie failed
            $link = new Link("lcm_cookie.php?cookie_test_failed=yes");
            $clean_link->delVar('privet');
            $url = str_replace('/./', '/', $clean_link->getUrl());
            $link->addVar('var_url', $url);
            @header("Location: " . $link->getUrl());
            exit;
        }
    }
    // If not authenticated, ask for login / password
    if (!$auth_login) {
        $url = $clean_link->getUrl();
        @header("Location: lcm_login.php?var_url=" . urlencode($url));
        exit;
    }
    //
    // Search for the login in the authors' table
    //
    $auth_login = addslashes($auth_login);
    $query = "SELECT * FROM lcm_author WHERE username='******' AND status !='external' AND status !='6forum'";
    $result = @lcm_query($query);
    if ($row = lcm_fetch_array($result)) {
        $connect_id_auteur = $row['id_author'];
        $connect_nom = $row['name_first'];
        $connect_login = $row['username'];
        $connect_pass = $row['password'];
        $connect_status = $row['status'];
        $connect_activer_messagerie = "non";
        //$row["messagerie"];
        $connect_activer_imessage = "non ";
        //$row["imessage"];
        // Set the users' preferences
        $prefs = unserialize(get_magic_quotes_runtime() ? stripslashes($row['prefs']) : $row['prefs']);
        //
        // Default values for some possibly unset preferences
        //
        if (!isset($prefs['page_rows']) || intval($prefs['page_rows']) < 1) {
            $prefs['page_rows'] = 15;
        }
        if (!isset($prefs['theme']) || !$prefs['theme']) {
            $prefs['theme'] = 'green';
        }
        if (!isset($prefs['screen']) || !$prefs['screen']) {
            $prefs['screen'] = 'wide';
        }
        if (!isset($prefs['font_size']) || !$prefs['font_size']) {
            $prefs['font_size'] = 'medium_font';
        }
        if (!isset($prefs['case_owner']) || !$prefs['case_owner']) {
            $prefs['case_owner'] = 'my';
        }
        if (!isset($prefs['case_period']) || !$prefs['case_period']) {
            $prefs['case_period'] = '91';
        }
        if (!isset($prefs['mode']) || !$prefs['mode']) {
            $prefs['mode'] = 'simple';
        }
        if (!isset($prefs['time_intervals']) || !$prefs['time_intervals']) {
            $prefs['time_intervals'] = 'relative';
            $prefs['time_intervals_notation'] = 'hours_only';
        }
    } else {
        // This case is a strange possibility: the author is authentified
        // OK, but he does not exist in the authors table. Possible cause:
        // the database was restaured and the author does not exist (and
        // the user was authentified by another source, such as LDAP).
        // Note: we use to show a strange error message which would advice
        // to logout, but since it occurs only after db upgrade, just logout
        // brutally (with cookie_admin=no to forget the username).
        lcm_header('Location: lcm_cookie.php?cookie_admin=no&logout=' . $auth_login);
        exit;
    }
    if (!$auth_pass_ok) {
        @header("Location: lcm_login.php?var_erreur=pass");
        exit;
    }
    // [ML] Again, not sure how this is used, but we can ignore it for now
    // TODO (note: nouveau == new)
    if ($connect_status == 'nouveau') {
        $query = "UPDATE lcm_author SET status = 'normal' WHERE id_author = {$connect_id_auteur}";
        $result = lcm_query($query);
        $connect_status = 'normal';
    }
    // PHP sessions are started here, and stopped at logout
    session_start();
    return true;
}
Ejemplo n.º 22
0
// Start the page with the proper title
if ($existing) {
    lcm_page_start(_T('title_author_edit'));
} else {
    lcm_page_start(_T('title_author_new'));
}
echo show_all_errors($_SESSION['errors']);
?>
<form name="edit_author" method="post" action="upd_author.php">
	<input name="id_author" type="hidden" id="id_author" value="<?php 
echo $user['id_author'];
?>
"/>
	<input name="ref_edit_author" type="hidden" id="ref_edit_author" value="<?php 
$ref_link = new Link($user['ref_edit_author']);
echo $ref_link->getUrl();
?>
"/>

	<table width="99%" border="0" align="center" cellpadding="5" cellspacing="0" class="tbl_usr_dtl">
		<?php 
//
// PERSONAL INFO
//
?>
		<tr>
			<td colspan="2" align="center" valign="middle" class="heading">
<?php 
show_page_subtitle(_T('authoredit_subtitle_personalinfo'), 'author_edit');
?>
			</td>