/**
  * save the changes...
  */
 function process()
 {
     global $errors, $selected, $create, $sitepage_CLNID, $cluster_node_NAME, $db, $oid, $sid, $clt;
     $this->check();
     if ($selected != "0" && $sitepage_CLNID != "0" && $sitepage_CLNID != "") {
         $mid = getVar("mid");
         $sql = "UPDATE sitepage SET CLNID = {$sitepage_CLNID} WHERE SPID = {$oid}";
         $query = new query($db, $sql);
         $query->free();
         // reload page, now in editing mode...
         global $db;
         $db->close();
         header("Location: sitepagebrowser.php?sid={$sid}&mid={$mid}&action=editobject&go=update&oid={$oid}");
         exit;
     } else {
         if ($create != "0" && $errors == "") {
             $mid = getVar("mid");
             $nextId = nextGUID();
             $sql = "INSERT INTO cluster_node (CLNID, CLT_ID, NAME, DELETED) VALUES({$nextId}, {$clt}, '{$cluster_node_NAME}', 0)";
             $query = new query($db, $sql);
             $sql = "UPDATE sitepage SET CLNID = {$nextId} WHERE SPID = {$oid}";
             $query = new query($db, $sql);
             $query->free();
             $backup = $oid;
             $oid = $nextId;
             syncClusterVariations();
             $oid = $backup;
             global $db;
             $db->close();
             header("Location: sitepagebrowser.php?sid={$sid}&mid={$mid}&action=editobject&go=update&oid={$oid}");
             exit;
         }
     }
 }
Esempio n. 2
0
function getVariables($id, $con)
{
    $url = 'https://bugzilla.mozilla.org/rest/bug?id=' . $id . '';
    $url_comment = 'https://bugzilla.mozilla.org/rest/bug/' . $id . '/comment';
    $url_changes = 'https://bugzilla.mozilla.org/rest/bug/' . $id . '/history';
    getVar($url, $url_comment, $url_changes, $id, $con);
}
Esempio n. 3
0
function RenderPage_login()
{
    global $config, $html;
    $config['title'] = 'Login';
    $html->setPageFrame('basic');
    // load page html
    $html->LoadCss('login.css');
    $outputs = RenderHTML::LoadHTML('pages/login.php');
    if (!is_array($outputs)) {
        echo 'Failed to load html!';
        exit;
    }
    // display error
    $messages = '';
    if (isset($_SESSION['error'])) {
        if (is_array($_SESSION['error'])) {
            foreach ($_SESSION['error'] as $msg) {
                $messages .= str_replace('{message}', $msg, $outputs['error']);
            }
        } else {
            $messages .= str_replace('{message}', $_SESSION['error'], $outputs['error']);
        }
        unset($_SESSION['error']);
    }
    $tags = array('messages' => $messages, 'username' => $config['demo'] ? 'demo' : getVar(LOGIN_FORM_USERNAME), 'password' => $config['demo'] ? 'demo' : '');
    RenderHTML::RenderTags($outputs['body'], $tags);
    unset($tags, $messages);
    return $outputs['body'];
}
Esempio n. 4
0
/**
 * main cron function
 * @return string
 */
function cron_main()
{
    global $config;
    // always send reminders and reminders
    churchcore_sendReminders();
    churchcore_sendMails();
    if (getVar("standby")) {
        // email with feedback image
        if ($id = getVar("mailqueue_id")) {
            db_query("UPDATE {cc_mail_queue} \n                SET reading_count = reading_count + 1 \n                WHERE id=:id", array(":id" => $id));
        }
        // Check if it's time to do a normal cron job
        if (getConf("cronjob_delay") > 0) {
            $last_cron = db_query("SELECT value old,  UNIX_TIMESTAMP() act \n                             FROM {cc_config} \n                             WHERE name='last_cron'")->fetch();
            if ($last_cron) {
                if ($last_cron->act - $config["cronjob_delay"] > $last_cron->old) {
                    db_query("UPDATE {cc_config} \n                    SET VALUE= UNIX_TIMESTAMP() \n                    WHERE name='last_cron'");
                    do_cron();
                }
            }
        }
        header('Content-Type: image/gif');
        //tiniest transparent GIF, credit: http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever
        echo base64_decode('R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
    } else {
        do_cron();
        if (getVar("manual")) {
            addInfoMessage(t("cronjob.succeed"));
            return " ";
        }
    }
}
Esempio n. 5
0
 function resetPassword()
 {
     global $db;
     $this->editAccount();
     $oldpwd = getVar('old-pwd', NULL, $_REQUEST, 'string');
     $pwd = getVar('password', NULL, $_REQUEST, 'string');
     $retpwd = getVar('retype-pwd', NULL, $_REQUEST, 'string');
     $authtype = AUTHENTICATION;
     if ($authtype != "internal") {
         echo "<script> \$('#pwd-data').prepend('<font color=orange>Feature not supported for this authentication mode!<br></font>');</script>";
     } else {
         if ($retpwd != $pwd) {
             echo "<script> \$('#pwd-data').prepend('<font color=red>The two passwords do not match!<br></font>');</script>";
         } else {
             $user = $_SESSION['loggedin'];
             $query = $db->makeQuery("select password from homer_logon where useremail = '?'", $user);
             $res = $db->loadObjectList($query);
             if (count($res) > 0) {
                 $pass_column = "password";
                 $oldpwd_db = $res[0]->{$pass_column};
                 if ($oldpwd_db != md5($oldpwd)) {
                     echo "<script> \$('#pwd-data').prepend('<font color=red>The old password is not correct!<br></font>');</script>";
                 } else {
                     $query = $db->makeQuery("update homer_logon SET password ='******' WHERE useremail = '?' limit 1;", md5($pwd), $_SESSION['loggedin']);
                     $db->executeQuery($query);
                     echo "<script> \$('#pwd-data').prepend('<font color=green>Password reset successfuly.<br></font>');</script>";
                 }
             } else {
                 echo "<script> \$('#pwd-data').prepend('<font color=red>Logged user not found!<br></font>');</script>";
             }
         }
     }
 }
		/**
		 * Standard constructor
		 * @param integer ID of the Cluster-Template-Item that is used to create this Content-Item.
		 * @param integer ID of the Cluster-Variation the clti is from.
     * @param booleean Forced Edit-All-Mode
     * @param booleaan Suppress permissions checks
		 */

		function AbstractEnvelope($clti, $cl, $forceEditAll=false, $isExternal = false) {
			global $db, $lang, $aclf, $isArticle;
      		$this->forceEditAll = $forceEditAll;
      		$this->clti = $clti;
			$this->cl = $cl;
			$this->action = value("action");
            $this->saction = value("saction");
			$this->eid = value("eid", "NUMERIC");
			if ($this->action == "0" || $this->action == "")
				$this->action = value("acstate");
            if (value("saction", "", "") != "")
                $this->action = getVar("lastaction");
			// Get the other configuration variables...
			$sql = "SELECT MINCARD, MAXCARD, NAME, FKID FROM cluster_template_items WHERE CLTI_ID = $clti";

			$query = new query($db, $sql);
			$query->getrow();
			$this->mincard = $query->field("MINCARD");
			$this->maxcard = $query->field("MAXCARD");
			$this->name = $query->field("NAME");
			$this->plugin = $query->field("FKID");
			$query->free();
			$this->editState = (($this->action == $lang->get("edit_all")) || ($this->action == $lang->get("save") || $this->action == $lang->get("save_back") || $this->action == "editsingle" || value("status") == "editsingle") && $this->action != $lang->get("back")) || $isArticle || $forceEditAll;
			if ($isExternal) {
			  $this->developer = true;
			  $this->editor    = true;	
			} else {
			  $this->developer =  $aclf->checkAccessToFunction("EDIT_CL_CONTENT");
			  $this->editor =  $aclf->checkAccessToFunction("EDIT_CL_CONTENT");
			}
			
			$this->members = $this->getItemData();
			$this->prepare_overview();
		}
 /**
  * Call function and returns JSON result
  *
  * @return string
  */
 function call()
 {
     $params = isset($_GET["func"]) ? $_GET : $_POST;
     if (!($func = getVar('func'))) {
         return jsend()->error("Parameter func nicht definiert!");
     }
     try {
         if (method_exists($this->module, $func)) {
             return jsend()->success($this->module->{$func}($params));
         }
         if (!isset($this->funcs[$func])) {
             return jsend()->error("Function {$func} was not defined as Function!");
         }
         $func = $this->funcs[$func];
         if ($func["auth"] != null) {
             // Split auth string for OR-Combinations
             $allowed = false;
             foreach (explode('||', $func["auth"]) as $val) {
                 if (user_access(trim($val), $func["module"])) {
                     $allowed = true;
                 }
             }
             if (!$allowed) {
                 throw new CTNoPermission($func["auth"], $func["module"]);
             }
         }
         return jsend()->success(call_user_func($this->getFunctionName($func["name"]), $params));
     } catch (CTFail $e) {
         return jsend()->fail($e);
     } catch (CTNoPermission $e) {
         return jsend()->fail($e);
     } catch (Exception $e) {
         return jsend()->error($e);
     }
 }
Esempio n. 8
0
function getVar($v, $d = '')
{
    if (isset($_GLOBAL[$v])) {
        return $_GLOBAL[$v];
    }
    if (isset($_SESSION[$v])) {
        return $_SESSION[$v];
    }
    if (isset($_COOKIE[$v])) {
        return $_COOKIE[$v];
    }
    if (isset($_GET[$v])) {
        return $_GET[$v];
    }
    if (isset($_POST[$v])) {
        return $_POST[$v];
    }
    if (isset($_FILES[$v])) {
        return $_FILES[$v];
    }
    if (isset($_SESSION['userdata'][$v]) && $v != 'password') {
        return $_SESSION['userdata'][$v];
    }
    if (isset($_SESSION['forms'][$v])) {
        return $_SESSION['forms'][$v];
    }
    if ($v != strtolower($v)) {
        return getVar(strtolower($v), $d);
    }
    return $d;
}
function PageMain()
{
    global $template, $templatesdir, $includesdir, $config;
    //Do any page logic here.
    //If $using_db is set in standard_page_logic.inc the global $db
    //will be set. Most db queries should be done in a class library, though.
    //This simple example does stuff internally. For complicated json, you
    //might be better off making a json template in templates/js
    $template['callback'] = getVar('callback');
    $template['echo'] = getVar('echo');
    if ($template['callback'] != "" && preg_match('/^\\w+$/', $template['callback'])) {
        //use jsonp
        header('Content-type: text/javascript');
    } else {
        //standard json
        header('Content-type: application/json');
    }
    $pid = getVar('plusid');
    if ($pid == "") {
        $pid = '109463793347920104139';
    }
    $person = new PlusPerson();
    $person->loadByGooglePlusID($pid);
    if ($person->plusperson_id == 0) {
        $person->googleplus_id = $pid;
        $person->updateFromGooglePlusService();
        $person->insertIntoDB();
    } else {
        if (strtotime($person->modified_dt) < strtotime("-6 hours")) {
            $person->updateFromGooglePlusService();
            $person->fetched_relationships = 0;
            $person->updateDB();
        }
    }
    //Get the posts from G+
    $posts = PlusPost::FetchActivityStream($person->googleplus_id);
    //Save them all into the DB (merge will try to update them if they exist already)
    foreach ($posts as $post) {
        $post->mergeStreamPostIntoDB();
    }
    $postsdata = array();
    foreach ($posts as $post) {
        $data = array('googleplus_postid' => $post->googleplus_postid, 'author_id' => $post->author_id, 'post_data' => $post->post_data, 'share_content' => $post->share_content, 'shared_postid' => $post->shared_postid);
        $postsdata[] = $data;
    }
    $persondata = array('googleplus_id' => $person->googleplus_id, 'first_name' => $person->first_name, 'last_name' => $person->last_name, 'profile_photo' => $person->profile_photo, 'introduction' => $person->introduction, 'subhead' => $person->subhead);
    $data = array('plusperson' => $persondata, 'posts' => $postsdata);
    $responsedata = json_encode($data);
    //wrap jsonp if necessary
    if ($template['callback'] != "" && preg_match('/^\\w+$/', $template['callback'])) {
        $responsedata = $template['callback'] . '(' . $responsedata . ');';
    }
    echo $responsedata;
}
Esempio n. 10
0
		/**
		 * standard constructor
		* @param string $headline Headline, to be displayed in the form
		* @param string $icon Icon, to be displayed in the form. Name of the file, stored in images folder.
		* @param string $name Name of the form. Will be used in HTML.
		* @param string $action Next script, that shall be called when submitting. Empty if self.
		* @param string $method POST or GET for sending the form. POST is default and strongly recommended
		* @param string $enctype Specify the enctype for the form. Use only when submitting files as multipart.
		*/
		function ObjectForm($headline, $icon = "", $name = "form1", $action = "", $method = "POST", $enctype = "") {
			Form::Form($headline, $icon, $name, $action, $method, $enctype);

			// initialize with values.
			global $oid, $action, $variation, $changevariation;
			$this->oid = $oid;
			$this->externalAction = $action;
			$this->title = getDBCell("content", "NAME", "CID = $oid");
			$this->headline .= ":&nbsp;" . $this->title;

			// get current variation!
			if (isset($variation) && isset($changevariation))
				pushVar("variation", $variation);

			$this->variation = getVar("variation");

			if ($this->variation == 0)
				$this->variation = 1; // set to standard.

			$this->populateVariations();

			// get current edit-scheme (META or CONTENT)
			global $changeeditor, $lang, $processing, $page_state;

			if (isset($changeeditor)) {
				pushVar("schemeEditor", $changeeditor);

				$processing = ""; // enable database loading if switched.
				$page_state = "START";
			}

			$this->editor = getVar("schemeEditor");

			if ($this->editor == "")
				$this->editor = $lang->get("ed_content");

			// prepare the form drawing.
			// check, if variation is defined or not.
			if (count($this->variations) > 0) {
				// define sniplets.
				$this->draw_jobButton();

				$this->draw_variationSelector();
				$this->draw_myBody();
				$this->draw_config();
			} else {
				global $lang;

				$this->addToTopText($lang->get("no_variations"));
				$this->setTopStyle($this->errorstyle);
			}
		}
Esempio n. 11
0
function RenderPage_login()
{
    global $config, $html;
    $config['title'] = 'Login';
    $html->setPageFrame('basic');
    // load page html
    $html->LoadCss('login.css');
    $outputs = RenderHTML::LoadHTML('pages/login.php');
    $html->addTags(array('messages' => '', 'username' => $config['demo'] ? 'demo' : getVar(LOGIN_FORM_USERNAME), 'password' => $config['demo'] ? 'demo' : ''));
    // display error
    if (getVar('error') != '') {
        $html->addTags(array('messages' => str_replace('{message}', 'Login Failed', $outputs['error'])));
    }
    return $outputs['body'];
}
Esempio n. 12
0
/**
 * retrieve list of search results
 *
 * @return string HTML list of search results
 */
function Search_showResults()
{
    // { variables
    global $PAGEDATA;
    $start = getVar('start', 0);
    $search = getVar('search');
    if (!$search) {
        return '<em id="searchResultsTitle">no search text entered</em>';
    }
    $totalfound = 0;
    $c = '';
    // }
    // { pages
    $q = dbAll('select * from pages where (name like "%' . $search . '%" or body like "%' . $search . '%") order by edate desc limit ' . $start . ',20');
    $n = count($q);
    if ($n > 0) {
        $totalfound += $n;
        foreach ($q as $p) {
            Page::getInstance($p['id'], $p);
        }
        $q = array_slice($q, $start, 20);
        $c .= '<h2>' . __('Page Search Results') . '</h2><em id="searchResultsTitle">';
        if ($n == 1) {
            $c .= __('1 result found');
        } else {
            $c .= __('%1 results found', $n);
        }
        $c .= '</em> <div>';
        if ($start > 0) {
            $c .= '[<a href="' . $PAGEDATA->getRelativeURL() . '?search=' . urlencode($search) . '&amp;start=' . ($start - 20) . '">previous 20</a>] ';
        }
        if ($start + 20 < $n) {
            $c .= '[<a href="' . $PAGEDATA->getRelativeURL() . '?search=' . urlencode($search) . '&amp;start=' . ($start + 20) . '">next 20</a>] ';
        }
        $c .= '<ol start="' . ($start + 1) . '" id="searchResults">';
        foreach ($q as $r) {
            $title = $r['title'] == '' ? $r['name'] : $r['title'];
            $c .= '<li><h4>' . htmlspecialchars($title) . '</h4>' . '<p>' . substr(preg_replace('/<[^>]*>/', '', $r['body']), 0, 200) . '...<br /><a href="/' . urlencode($r['name']) . '?search=' . $search . '">/' . htmlspecialchars($r['name']) . '</a></p></li>';
        }
        $c .= '</ol></div>';
    }
    // }
    if (!$totalfound) {
        $c .= '<em id="searchResultsTitle">no results found</em>';
    }
    return $c;
}
function getVarClean($name, $type = '', $defaultValue = NULL)
{
    $var = getVar($name);
    $var = cleanVar($var);
    if ($var == '' && $defaultValue !== NULL) {
        return $defaultValue;
    }
    if (!isset($type)) {
        return $var;
    }
    switch ($type) {
        case 'bool':
            if (is_bool($var)) {
                return $var;
            }
            break;
        case 'str':
        case 'string':
            if (is_string($var)) {
                return $var;
            }
            break;
        case 'object':
            if (is_object($var)) {
                return $var;
            }
            break;
        case 'array':
            if (is_array($var)) {
                return $var;
            }
            break;
        case 'float':
        case 'int':
        case 'numeric':
            if (is_numeric($var)) {
                return $var;
            }
            break;
        default:
            return $var;
    }
    if (isset($defaultValue)) {
        return $defaultValue;
    }
    return '';
}
function PageMain()
{
    global $template, $templatesdir, $includesdir, $config;
    //Do any page logic here.
    //If $using_db is set in standard_page_logic.inc the global $db
    //will be set. Most db queries should be done in a class library, though.
    //This simple example does stuff internally. For complicated json, you
    //might be better off making a json template in templates/js
    $template['callback'] = getVar('callback');
    $template['echo'] = getVar('echo');
    if ($template['callback'] != "" && preg_match('/^\\w+$/', $template['callback'])) {
        //use jsonp
        header('Content-type: text/javascript');
    } else {
        //standard json
        header('Content-type: application/json');
    }
    $pid = getVar('plusid');
    if ($pid == "") {
        $pid = '109463793347920104139';
    }
    $plookup = array();
    $linklookup = array();
    $people = array();
    $links = array();
    //This person
    $person = getCachedPerson($pid);
    $pdata = extractPersonData($person, 0);
    $plookup[$pdata['id']] = 1;
    //Followees
    $followees = PlusPerson::FetchVisiblePlusPeople($person->googleplus_id);
    foreach ($followees as $followee) {
        $pdata = extractPersonData($followee, 1);
        if (!isset($plookup[$pdata['id']])) {
            $people[] = $pdata;
            $plookup[$pdata['id']] = 1;
        }
    }
    $data = array('person' => extractPersonData($person, 0), 'relationships' => $people);
    $responsedata = json_encode($data);
    //wrap jsonp if necessary
    if ($template['callback'] != "" && preg_match('/^\\w+$/', $template['callback'])) {
        $responsedata = $template['callback'] . '(' . $responsedata . ');';
    }
    echo $responsedata;
}
Esempio n. 15
0
function isSelected($name, $option, $default = false, $return = false)
{
    if (postVar($name, true) == $option || getVar($name, true) == $option) {
        /* make sure == not used (for string to int comparison) */
        if ($return) {
            return 'selected';
        }
        echo 'selected';
    } else {
        if (!postVar($name, true) && !getVar($name, true) && $default) {
            if ($return) {
                return 'selected';
            }
            echo 'selected';
        }
    }
}
Esempio n. 16
0
function getLastPage()
{
    global $config;
    if (!empty($config['lastpage'])) {
        return $config['lastpage'];
    }
    $lastpage = getVar('lastpage');
    if (empty($lastpage)) {
        $lastpage = @$_SERVER['HTTP_REFERER'];
    } elseif (startsWith($lastpage, 'page-')) {
        $lastpage = './?page=' . substr($lastpage, strlen('page-'));
    }
    if (empty($lastpage)) {
        $lastpage = './';
    }
    $config['lastpage'] = $lastpage;
    return $lastpage;
}
 function CreateHtml()
 {
     global $sid;
     if (!isset($sid)) {
         $sid = getVar($sid);
     }
     $HtmlValue = htmlspecialchars($this->Value);
     $Html = '<div>';
     if ($this->IsCompatible()) {
         if (isset($_GET['fcksource']) && $_GET['fcksource'] == "true") {
             $File = 'fckeditor.original.html';
         } else {
             $File = 'fckeditor.html';
         }
         $Link = "{$this->BasePath}editor/{$File}?InstanceName={$this->InstanceName}&sid={$sid}";
         if ($this->ToolbarSet != '') {
             $Link .= "&amp;Toolbar={$this->ToolbarSet}";
         }
         // Render the linked hidden field.
         $Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}\" name=\"{$this->InstanceName}\" value=\"{$HtmlValue}\" style=\"display:none\" />";
         // Render the configurations hidden field.
         $Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}___Config\" value=\"" . $this->GetConfigFieldString() . "\" style=\"display:none\" />";
         // Render the editor IFRAME.
         $Html .= "<iframe id=\"{$this->InstanceName}___Frame\" src=\"{$Link}\" width=\"{$this->Width}\" height=\"{$this->Height}\" frameborder=\"0\" scrolling=\"no\"></iframe>";
     } else {
         if (strpos($this->Width, '%') === false) {
             $WidthCSS = $this->Width . 'px';
         } else {
             $WidthCSS = $this->Width;
         }
         if (strpos($this->Height, '%') === false) {
             $HeightCSS = $this->Height . 'px';
         } else {
             $HeightCSS = $this->Height;
         }
         $Html .= "<textarea name=\"{$this->InstanceName}\" rows=\"4\" cols=\"40\" style=\"width: {$WidthCSS}; height: {$HeightCSS}\">{$HtmlValue}</textarea>";
     }
     $Html .= '</div>';
     return $Html;
 }
Esempio n. 18
0
 /**
  * standard constructor.
  */
 function TabBar($tabid = 'menu', $id = "mmid")
 {
     $this->id = $id;
     $temp_menu = $_GET[$this->id];
     if ($temp_menu == '') {
         $temp_menu = $_POST[$this->id];
     }
     if ($temp_menu == '') {
         $temp_menu = getVar($tabid);
     }
     $this->selectedMenu = 1;
     $this->selectedSubmenu = 0;
     if ($temp_menu != "") {
         //process the menu id (mid) now.
         // it has Form: <menu>x<submenu>
         $msplit = explode("x", $temp_menu);
         $this->selectedMenu = $msplit[0];
         $this->selectedSubmenu = $msplit[1];
     }
     pushVar($tabid, $temp_menu);
     $this->doc = $_SERVER['REQUEST_URI'];
 }
Esempio n. 19
0
function icqStatus($uin, $return = false)
{
    $stored = getVar('icq:' . $uin);
    $upd = true;
    $nowtime = time();
    if (!empty($stored)) {
        $stored = unserialize($stored);
        if ($stored['when'] + 3600 <= $nowtime) {
            $upd = true;
        } else {
            $upd = false;
        }
    }
    if ($upd) {
        //Проверка icq статуса
        $status = 'na';
        $fp = @fsockopen("status.icq.com", 80);
        if ($fp) {
            fputs($fp, "GET /online.gif?icq={$uin}&img=5 HTTP/1.0\n\n");
            while ($line = fgets($fp, 128)) {
                if (strpos($line, 'Location') !== false) {
                    if (strpos($line, 'online1') !== false) {
                        $status = 'online';
                    } elseif (strpos($line, 'online0') !== false) {
                        $status = 'offline';
                    }
                    break;
                }
            }
        }
        $stored = array('when' => $nowtime, 'status' => $status);
        setVar('icq:' . $uin, serialize($stored));
    }
    if ($return) {
        return $stored['status'];
    } else {
        echo '<img src="/Images/Icons/icq/' . $stored['status'] . '.gif" width="15" height="15" alt="icq ' . $stored['status'] . '" /> ' . $uin;
    }
}
Esempio n. 20
0
		/**
		 * standard constructor.
		 */
		function cmsmenu() {
			global $mid, $auth;

			$temp_menu = "";

			if (!isset($mid)) {
				$temp_menu = getVar("menu");
			} else {
				$temp_menu = $mid;
			}

			if ($temp_menu != "") {
				//process the menu id (mid) now.
				// it has Form: <menu>x<submenu>
				$msplit = explode("x", $temp_menu);

				$this->selectedMenu = $msplit[0];
				$this->selectedSubmenu = $msplit[1];
			}

			pushVar("menu", $temp_menu);
		}
Esempio n. 21
0
		/**
		 * @param string db-table, on which you want to filter
		 * @param string primary key of the table
		 */
		function Filter($table, $pk) {
			global $lang;
			$this->table = $table;

			$this->pk = $pk;
			$this->icon = "li_standard.gif"; // 14x11 pixels.
			$this->type_name = "Records";
			// get the action template to use.
			$temp = explode("?", $_SERVER["REQUEST_URI"]);
			$temp2 = explode("/", $temp[0]);
			$this->link_action = $temp2[count($temp2) - 1];
			$this->new_action = $this->link_action;
			$this->newLabel = $lang->get("new");

			// check and initialize filter variables.
			$filter_rule = parseSQL(value("filter_rule", "", ""));
			$filter_column = value("filter_column", "NOSPACES");
			$filter_page = value("filter_page");

			if ($filter_rule != "0") {
				pushVar($this->link_action . "filter_rule", value("filter_rule", "", ""));

				pushVar($this->link_action . "filter_page", 1);
			}

			if ($filter_column != "0") {
				pushVar($this->link_action . "filter_column", value("filter_column"));

				pushVar($this->link_action . "filter_page", 1);
			}

			if ($filter_page != "0")
				pushVar($this->link_action . "filter_page", value("filter_page"));

			$this->filter_rule = getVar($this->link_action . "filter_rule");
			$this->filter_column = getVar($this->link_action . "filter_column");
		}
function PageMain()
{
    global $template, $templatesdir, $includesdir, $config;
    //Do any page logic here.
    //If $using_db is set in standard_page_logic.inc the global $db
    //will be set. Most db queries should be done in a class library, though.
    $template['title'] = 'PlusActivity API Test';
    $pid = getVar('plusid');
    if ($pid == "") {
        $pid = '109463793347920104139';
    }
    $person = new PlusPerson();
    $person->loadByGooglePlusID($pid);
    if ($person->plusperson_id == 0) {
        $person->googleplus_id = $pid;
        $person->updateFromGooglePlusService();
        $person->insertIntoDB();
    } else {
        if (strtotime($person->modified_dt) < strtotime("-6 hours")) {
            $person->updateFromGooglePlusService();
            $person->updateDB();
        }
    }
    $template['title'] = $person->first_name . " " . $person->last_name . " // " . $template['title'];
    //Get the posts from G+
    $posts = PlusPost::FetchActivityStream($person->googleplus_id);
    //Save them all into the DB (merge will try to update them if they exist already)
    foreach ($posts as $post) {
        $post->mergeStreamPostIntoDB();
    }
    //Pull them back out of the db for display
    $posts = PlusPost::FetchPostsByGooglePlusID($person->googleplus_id);
    $template['person'] = $person;
    $template['posts'] = $posts;
    require_once $templatesdir . 'pages/tests/plusactivity.inc';
}
Esempio n. 23
0
function RenderPage_auctions_ajax()
{
    global $config, $html;
    //file_put_contents('ajax_get.txt',print_r($_GET,TRUE));
    header('Content-Type: text/plain');
    // list auctions
    $auctions = QueryAuctions::QueryCurrent();
    $TotalDisplaying = QueryAuctions::TotalDisplaying();
    $TotalAllRows = QueryAuctions::TotalAllRows();
    $outputRows = "{\n" . "\t" . '"iTotalDisplayRecords" : ' . $TotalDisplaying . ",\n" . "\t" . '"iTotalRecords" : ' . $TotalAllRows . ",\n" . "\t" . '"sEcho" : ' . (int) getVar('sEcho', 'int') . ",\n" . "\t" . '"aaData" : [' . "\n";
    if ($TotalDisplaying < 1) {
        unset($auctions);
    } else {
        $outputRows .= "\t{\n";
        $count = 0;
        while (TRUE) {
            $auction = $auctions->getNext();
            if (!$auction) {
                break;
            }
            $Item = $auction->getItem();
            if (!$Item) {
                continue;
            }
            if ($count != 0) {
                $outputRows .= "\t},\n\t{\n";
            }
            $count++;
            $data = array('item' => $Item->getDisplay(), 'seller' => '<img src="./?page=mcskin&user='******'" width="32" height="32" alt="" /><br />' . $auction->getSeller(), 'price each' => FormatPrice($auction->getPrice()), 'price total' => FormatPrice($auction->getPriceTotal()), 'market percent' => '--', 'qty' => (int) $Item->getItemQty());
            // buy button
            if ($config['user']->hasPerms('canBuy')) {
                $data['canBuy'] = '
          <form action="./" method="post">
          ' . CSRF::getTokenForm() . '
          <input type="hidden" name="page"      value="' . $config['page'] . '" />
          <input type="hidden" name="action"    value="buy" />
          <input type="hidden" name="auctionid" value="' . (int) $auction->getTableRowId() . '" />
          <input type="text" name="qty" value="' . (int) $data['qty'] . '" onkeypress="return numbersonly(this, event);" ' . 'class="input" style="width: 60px; margin-bottom: 5px; text-align: center;" /><br />
          <input type="submit" value="Buy" class="button" />
          </form>
';
            }
            // cancel button
            if ($config['user']->hasPerms('isAdmin')) {
                $data['isAdmin'] = '
          <form action="./" method="post">
          ' . CSRF::getTokenForm() . '
          <input type="hidden" name="page"      value="' . $config['page'] . '" />
          <input type="hidden" name="action"    value="cancel" />
          <input type="hidden" name="auctionid" value="' . (int) $auction->getTableRowId() . '" />
          <input type="submit" value="Cancel" class="button" />
          </form>
';
            }
            // sanitize
            $data = str_replace(array('/', '"', "\r", "\n"), array('\\/', '\\"', '', '\\n'), $data);
            $rowClass = 'gradeU';
            //TODO:
            //gradeA
            //gradeC
            //gradeX
            //gradeU
            $outputRows .= "\t\t" . '"DT_RowClass":"' . $rowClass . '",' . "\n";
            $i = -1;
            foreach ($data as $v) {
                $i++;
                if ($i != 0) {
                    $outputRows .= ",\n";
                }
                $outputRows .= "\t\t" . '"' . $i . '":"' . $v . '"';
            }
            $outputRows .= "\n";
        }
        unset($auctions, $Item);
        $outputRows .= "\t}\n";
    }
    $outputRows .= ']}' . "\n";
    //file_put_contents('ajax_output.txt',$outputRows);
    echo $outputRows;
    exit;
}
Esempio n. 24
0
 function showCreateNode($type)
 {
     global $mynodeshost, $db, $task, $component;
     $userid = $user->id;
     $returntask = getVar('returntask', NULL, $_REQUEST, 'string');
     $host = getVar('host', NULL, $_REQUEST, 'string');
     $name = getVar('name', NULL, $_REQUEST, 'string');
     $status = getVar('status', 1, $_REQUEST, 'int');
     $database = getVar('dbname', NULL, $_REQUEST, 'string');
     $port = getVar('dbport', NULL, $_REQUEST, 'string');
     $username = getVar('dbusername', NULL, $_REQUEST, 'string');
     $password = getVar('dbpassword', NULL, $_REQUEST, 'string');
     $table = $type == 1 ? "homer_nodes" : "homer_hosts";
     if ($type == 1) {
         $db->qry("INSERT into {$table} set host='?', name='?', status='?', dbname='?', dbport='?', dbusername='******', dbpassword='******'", $host, $name, $status, $database, $port, $username, $password);
     } else {
         $db->qry("INSERT into {$table} set host='?', name='?', status='?'", $host, $name, $status);
     }
     $this->myLocalRedirect("index.php?component={$component}");
     exit;
 }
Esempio n. 25
0
$set = getVar("set");
$nl_grp_id = 0;
$standard = 0;
//field names for query
$InputName_Name = "name";
//range from
${$InputName_Name} = getVar($InputName_Name);
$InputName_Descr = "descr";
//range from
${$InputName_Descr} = getVar($InputName_Descr, 0);
$InputName_Aktiv = "aktiv";
//range from
${$InputName_Aktiv} = getVar($InputName_Aktiv);
//
$InputName_Color = "color";
${$InputName_Color} = getVar($InputName_Color);
$InputName_ColorView = "color_view";
//nur anzeige....
$check = true;
if ($set == "save") {
    //checkinput
    if (empty($name)) {
        $check = false;
        $_MAIN_MESSAGE .= "<br>" . ___("Name der Gruppe sollte nicht leer sein.");
    }
    if ($check) {
        $NEWSLETTER = new tm_NL();
        $NEWSLETTER->addGrp(array("name" => $name, "descr" => $descr, "aktiv" => $aktiv, "created" => $created, "author" => $author));
        $_MAIN_MESSAGE .= "<br>" . sprintf(___("Neue Newslettergruppe %s wurde erstellt."), "'<b>" . display($name) . "</b>'");
        $action = "nl_grp_list";
        require_once TM_INCLUDEPATH . "/nl_grp_list.inc.php";
     for ($i = 0; $i < count($lang_names); ++$i) {
         if (!$lang_names[$i] || !$lang_isos[$i]) {
             continue;
         }
         $langs[] = '{"name":"' . addslashes($lang_names[$i]) . '","iso":"' . addslashes($lang_isos[$i]) . '"}';
     }
     $langs = addslashes('[' . join(',', $langs) . ']');
 }
 dbQuery("INSERT INTO site_vars SET name='languages',value='{$langs}'");
 // }
 // { currencies
 $curs = '';
 $cur_names = getVar('cur_name');
 $cur_isos = getVar('cur_iso');
 $cur_symbols = getVar('cur_symbol');
 $cur_values = getVar('cur_value');
 if (is_array($cur_names) && is_array($cur_isos) && is_array($cur_values)) {
     $curs = array();
     for ($i = 0; $i < count($cur_names); ++$i) {
         if (!$cur_names[$i] || !$cur_isos[$i] || !$cur_values[$i] || !$cur_symbols[$i]) {
             continue;
         }
         if (!$i) {
             $cur_values[0] = 1;
         }
         $curs[] = '{"name":"' . addslashes($cur_names[$i]) . '","iso":"' . addslashes($cur_isos[$i]) . '","symbol":"' . addslashes($cur_symbols[$i]) . '","value":"' . addslashes($cur_values[$i]) . '"}';
     }
     $curs = addslashes('[' . join(',', $curs) . ']');
 }
 dbQuery("INSERT INTO site_vars SET name='currencies',value='{$curs}'");
 // }
Esempio n. 27
0
<?php

require 'init.php';
if (getVar('category')) {
    $articlesQuery = $dbh->prepare("SELECT articles.id, articles.title, articles.description, categories.name AS category, articles.date FROM articles JOIN categories ON articles.category_id = categories.id WHERE articles.category_id = :category AND articles.private = 0 OR articles.private = :private ORDER BY articles.id DESC LIMIT :start,4 ");
    $articlesQuery->execute(array('category' => getVar('category'), 'start' => getVar('page') * 4, 'private' => isGuest()));
    $articles = $articlesQuery->fetchAll();
    $allArticlesQuery = $dbh->prepare("SELECT articles.id, articles.title, articles.description, categories.name AS category, articles.date FROM articles JOIN categories ON articles.category_id = categories.id WHERE articles.category_id = :category AND articles.private = 0 OR articles.private = :private");
    $allArticlesQuery->execute(array('category' => getVar('category'), 'private' => isGuest()));
} else {
    $articlesQuery = $dbh->prepare("SELECT articles.id, articles.title, articles.description, categories.name AS category, articles.date FROM articles JOIN categories ON articles.category_id = categories.id WHERE articles.private = 0 OR articles.private = :private ORDER BY articles.id DESC LIMIT :start,4 ");
    $articlesQuery->execute(array('start' => getVar('page') * 4, 'private' => isGuest()));
    $articles = $articlesQuery->fetchAll();
    $allArticlesQuery = $dbh->prepare("SELECT articles.id, articles.title, articles.description, categories.name AS category, articles.date FROM articles JOIN categories ON articles.category_id = categories.id WHERE articles.private = 0 OR articles.private = :private");
    $allArticlesQuery->execute(array('private' => isGuest()));
}
$maxPages = round($allArticlesQuery->rowCount() / 4);
$categoriesQuery = $dbh->prepare("SELECT id, name FROM categories ");
$categoriesQuery->execute();
$categories = $categoriesQuery->fetchAll();
$page = getVar('page') ? getVar('page') : 1;
render('index', array('articles' => $articles, 'categories' => $categories, 'url' => 'index.php', 'npage' => $page, 'maxPages' => $maxPages));
Esempio n. 28
0
if (!isset($limit)) {
    $limit = getVar("limit");
}
if (empty($limit)) {
    $limit = 25;
}
$no_list = getVar("no_list");
//sort und sorttype nach search verschoben
$ADDRESS = new tm_ADR();
$QUEUE = new tm_Q();
$BLACKLIST = new tm_BLACKLIST();
$adr_grp_id = getVar("adr_grp_id");
$adr_id = getVar("adr_id");
$set = getVar("set");
$val = getVar("val");
$doit = getVar("doit");
//wird per js an url angefuegt!!! confirm()
if (!isset($search)) {
    $search = array();
}
require_once TM_INCLUDEPATH . "/adr_search.inc.php";
if ($no_list != 1) {
    if ($set == "aktiv") {
        $ADDRESS->setAktiv($adr_id, $val);
        if ($val == 1) {
            $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde aktiviert.");
        } else {
            $_MAIN_MESSAGE .= "<br>" . ___("Eintrag wurde de-aktiviert.");
        }
    }
    //aktiv single
/*
aufruf ohne parameter --> blindimage XxY Pixel oder auch global...? :)

aufruf mit parameter:
settings per newsletter -->
	blankimage ? --> blank png erzeigen
	eigenes bild --> extension auslesen, jpg oder png erzeugen
	global? --> globale settings auslesen
		blank? --> blank png erzeugen
		eigenes bild --> extension auslesen, jpg oder png erzeugen

	bild ausgeben.
*/
$h_id = getVar("h_id");
$nl_id = getVar("nl_id");
$a_id = getVar("a_id");
$TrackImageType = "png";
$create_track_image = false;
if (checkid($nl_id)) {
    $NEWSLETTER = new tm_NL();
    //nl holen
    $NL = $NEWSLETTER->getNL($nl_id);
    //wenn newsletter gefunden, ok
    if (count($NL) > 0) {
        $create_track_image = true;
    }
    //nl view counter ++
    $NEWSLETTER->addView($nl_id);
    //history id? dann in der historie auf view setzen!
    if (checkid($h_id)) {
        $QUEUE = new tm_Q();
Esempio n. 30
0
if (${$InputName_SendAtTimeM} == "") {
    ${$InputName_SendAtTimeM} = date("i");
}
$InputName_Group = "adr_grp";
pt_register("POST", "adr_grp");
if (!isset($adr_grp)) {
    $adr_grp = array();
}
$InputName_Send = "send_now";
${$InputName_Send} = getVar($InputName_Send);
$InputName_Autogen = "autogen";
${$InputName_Autogen} = getVar($InputName_Autogen);
$InputName_Blacklist = "check_blacklist";
${$InputName_Blacklist} = getVar($InputName_Blacklist);
$InputName_Proof = "proof";
${$InputName_Proof} = getVar($InputName_Proof);
$check = true;
//abgeschickt?
if ($set == "save") {
    if (!empty($nl_id)) {
        $HOST = $HOSTS->getHost($host_id, array("aktiv" => 1, "type" => "smtp"));
        //SMTP Server ausgewaehlt?
        if (count($HOST) == 1) {
            $gc = count($adr_grp);
            //sind ueberhaupt gruppen gewaehlt???
            if ($gc > 0) {
                $QUEUE = new tm_Q();
                $ADDRESS = new tm_ADR();
                $_MAIN_MESSAGE .= "<br>" . sprintf(___("Ausgewählter Mail-Server: %s"), $HOST[0]['name']);
                if ($check_blacklist == 1) {
                    $_MAIN_MESSAGE .= "<br>" . tm_icon("ruby.png", ___("Blacklist")) . "&nbsp;" . ___("Blacklist Überprüfung aktiv");