Exemplo n.º 1
0
    protected function users_auths()
    {
        $this->current_step = 'users_auths';
        $output = '<table width="60%" cellpadding="1" cellspacing="1" align="center" class="task_table colorswitch">';
        $output .= '<tr><td colspan="3" class="row2">' . $this->lang['your_user'] . '{USER_SELECT}</td></tr>';
        $output .= '<tr><th colspan="3" class="th_sub">' . $this->lang['which_users'] . ' ' . $this->js_mark_boxes('{NUM}', 'u_') . '</th></tr>';
        $output .= '<tr><td colspan="3" align="center">
						<div class="errorbox roundbox">
							<div class="icon_false">' . $this->lang['notice_admin_perm'] . '</div>
						</div>	
				</td></tr>';
        //build userlist
        $users = array();
        $admins = array();
        $this->connect2olddb();
        //look for users with admin-rights
        $result = $this->old[0]->query("SELECT u.user_id FROM " . $this->old[1] . "auth_users u, " . $this->old[1] . "auth_options o WHERE u.auth_id = o.auth_id AND o.auth_value IN ('a_users_man', 'a_config_man') AND u.auth_setting = 'Y';");
        while ($row = $this->old[0]->fetch_record($result)) {
            $admins[] = $row['user_id'];
        }
        $this->old[0]->free_result($result);
        $result = $this->old[0]->query("SELECT username, user_id FROM " . $this->old[1] . "users ORDER BY username ASC;");
        $c = 0;
        while ($row = $this->old[0]->fetch_record($result)) {
            $users[$c]['id'] = $row['user_id'];
            $users[$c]['name'] = $row['username'];
            if (in_array($row['user_id'], $admins)) {
                $users[$c]['admin'] = true;
            }
            $c++;
        }
        unset($admins);
        $u_sel = '<select name="your_user"><option value="0">' . $this->lang['no_user'] . '</option>';
        foreach ($users as $suser) {
            $sel = $this->user->data['username'] == $suser['name'] ? " selected='selected'" : "";
            $u_sel .= "<option value='" . $suser['id'] . "'" . $sel . ">" . $suser['name'] . "</option>";
        }
        $output = str_replace('{USER_SELECT}', $u_sel, $output);
        $max = count($users);
        $output = str_replace('{NUM}', $max, $output);
        $rows = $max / 3;
        settype($rows, 'int');
        if ($rows < $max / 3) {
            $rows++;
        }
        $done = array();
        function get_output($num, $users, $lang_admin, $colspan = '')
        {
            $out = "<td width='33%'" . $colspan . "><input type='checkbox' name='user_id[]' id='u_" . $num . "' value='" . $users[$num]['id'] . "' checked='checked' />";
            $checked = $users[$num]['admin'] ? "checked='checked' " : '';
            $out .= $users[$num]['name'] . " (<input type='checkbox' name='admin[" . $users[$num]['id'] . "]' value='1' " . $checked . "> " . $lang_admin . ")</td>";
            return $out;
        }
        for ($i = 0; $i < $rows; $i++) {
            $one = false;
            $two = false;
            $output .= "<tr>";
            if (!in_array($i, $done) and $i < $max) {
                $output .= get_output($i, $users, $this->lang['admin']);
                $one = true;
            }
            if (!in_array($i + $rows, $done) and $i + $rows < $max) {
                $output .= get_output($i + $rows, $users, $this->lang['admin'], $one ? '' : " colspan='2'");
                $two = true;
            }
            if (!in_array($i + 2 * $rows, $done) and $i + 2 * $rows < $max) {
                $colspan = $one ? $two ? '' : " colspan='2'" : ($two ? " colspan='2'" : " colspan='3'");
                $output .= get_output($i + 2 * $rows, $users, $this->lang['admin'], $colspan);
            }
            $output .= "</tr>";
            $done[] = $i;
            $done[] = $i + $rows;
            $done[] = $i + 2 * $rows;
        }
        $output .= "<tr><th colspan='3' class='th_sub'><input type='submit' name='users_auths' value='" . $this->lang['submit'] . "' class='mainoption'/></th></tr></table>";
        return $output;
    }
Exemplo n.º 2
0
*
*      http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
* 
*****/
require_once "class.ActionFactory.php";
$search_phrase = $_REQUEST['msg'];
$lookup_object = ActionFactory::get_lookup_object($search_phrase, "twitter");
$type = $lookup_object->get_type();
echo "<a href='form.php'>NEXT SEARCH</a><br />";
echo get_output($lookup_object);
unset($lookup_object);
function get_output($lookup_object)
{
    $got_errors = false;
    if ($lookup_object->is_ready() && $lookup_object->is_search()) {
        $got_results = $lookup_object->_perform();
        if ($got_results) {
            $defintions = $lookup_object->the_output();
            if (is_array($defintions)) {
                //Util::print_array($defintions);
                if ($defintions[$lookup_object->get_type()]) {
                    foreach ($defintions[$lookup_object->get_type()] as $defi) {
                        echo "Definition : " . $defi . "<br>";
                    }
                } else {
Exemplo n.º 3
0
function drawBreadcrumbs($matches, $separator, $others_in_hierarchy, $pgs, $names, $pgsdirs, $tooltips, $fixed = "", $fixedname = "", $fixeddir = "", $fixedtooltip = "", $mainsw = "", $mainswname = "", $mainswdir = "", $mainswtooltip = "", $gets = "", $gets2 = "", $duplicate = "")
{
    global $bcprint, $linkrelprevs;
    $count = count($pgs);
    for ($i = 0; $i < $count; $i++) {
        if ($matches[1] == $pgs[$i]) {
            $rank = $i;
            if ($duplicate != "") {
            } else {
                break;
                // just make this break?
            }
        }
        // end if
    }
    // end for
    $bcprint .= "\n<div class='breadcrumbs'> &nbsp; &nbsp; &nbsp; &nbsp;";
    if ($fixed != "") {
        // Makes links for a list of fixed sequential items always mandatory to that category (if any)
        $countall = count($fixed);
        for ($j = 0; $j < $countall; $j++) {
            if ($fixedtooltip[$j] != "") {
                $tooltip = "title=\"" . $fixedtooltip[$j] . "\"";
            } else {
                $tooltip = "";
            }
            // end else
            $bcprint .= <<<HERE

<a class="breadcrumbs" dir="{$fixeddir[$j]}" href="{$fixed[$j]}" {$tooltip}>{$fixedname[$j]}</a>
<span class="breadcrumbs">{$separator}</span>
HERE;
            if ($j == $countall - 1) {
                $linkrelprevs = get_output("Prev", $pgs[$rank], $fixed[$j], $fixedname[$j]);
            }
            // end if
        }
        // end for
    }
    // end if
    if ($others_in_hierarchy == 1) {
        $v = 0;
        for ($i = 0; $i < $rank; $i++) {
            $r = 0;
            if ($tooltips[$i] != "") {
                $tooltip = "title=\"" . $tooltips[$i] . "\"";
            } else {
                $tooltip = "";
            }
            // end else
            if ($gets[$v][0] != "") {
                $getdata = "?" . $gets[$v][0] . "=" . $gets[$v][1];
                $r++;
            } else {
                $getdata = "";
                // Needed for resetting if for loop starts over and $gets is blank this time
            }
            // end else
            if ($r < 1 && $gets2[$v][0] != "") {
                $getdata = "?" . $gets2[$v][0] . "=" . $gets2[$v][1];
            } elseif ($r >= 1 && $gets2[$v][0] != "") {
                $getdata .= "&amp;" . $gets2[$v][0] . "=" . $gets2[$v][1];
            }
            // end elseif
            $v++;
            $bcprint .= <<<HERE

<a class="breadcrumbs" dir="{$pgsdirs[$i]}" href="{$pgs[$i]}{$getdata}" {$tooltip}>{$names[$i]}</a>
<span class="breadcrumbs">{$separator}</span>
HERE;
            if ($i == $rank - 1) {
                $linkrelprevs = get_output("Prev", $pgs[$rank], $pgs[$i], $names[$i], $getdata);
            }
            // end if
        }
        // end for
    }
    // end if
    if ($mainsw[$rank] != "") {
        $tooltip = "title=\"" . $mainswtooltip[$rank] . "\"";
        $bcprint .= <<<HERE

<a class="breadcrumbs" dir="{$mainswdir[$rank]}" href="{$mainsw[$rank]}" {$tooltip}>{$mainswname[$rank]}</a>
<span class="breadcrumbs">{$separator}</span>
HERE;
        $linkrelprevs = get_output("Prev", $pgs[$rank], $mainsw[$rank], $mainswname[$rank], "");
    }
    // end if
    // Get ready to print the name of the current page (no need for a link)
    $bcprint .= <<<HERE
<span class="breadcrumbs" dir="{$pgsdirs[$rank]}">{$names[$rank]}</span>
HERE;
    $bcprint .= "</div>";
    return 1;
}