function db_error_logger($errno, $errstr, $errfile = "", $errline = "", $errorcontext = array()){
	
		$errno = makeStringSafe($errno);
		$errstr = makeStringSafe($errstr);
		$errfile = makeStringSafe($errfile);
		$errline = makeStringSafe($errline);
		
		if($errno < E_STRICT){
	
			doQuery("INSERT INTO ".getDBPrefix()."_error_log set user_id = '".getSessionVariable("user_id")."', error_number = '".$errno."',
				message = '".$errstr."', file = '".$errfile."', line_number = '".$errline."', context = '".serialize($errorcontext)."',
				time = '".getCurrentMySQLDateTime()."'");
				
			$errorrow = mysql_fetch_assoc(doQuery("SELECT error_id FROM ".getDBPrefix()."_error_log ORDER BY error_id DESC LIMIT 1"));
			
			if(getConfigVar('error_output') == ERROR_OUTPUT_DBID || getConfigVar('error_output') == ERROR_OUTPUT_BOTH){
			
				echo "<h4 style=\"color: #FF0000;\">An error occured! If you would like to report this error, please report that your 'ERROR_ID' is '".$errorrow['error_id']."'.</h4>";
			
			}
		
		}
		
		return !(getConfigVar("error_output") == ERROR_OUTPUT_PHP || getConfigVar("error_output") == ERROR_OUTPUT_BOTH);
	
	}
 public function getInstalled($uId)
 {
     $db_prefix = getDbPrefix();
     $result = doQuery("SELECT `appid` FROM {$db_prefix}userapp WHERE `uid` = {$uId}");
     $result = getSubByKey($result, 'appid');
     return new APIResponse($result);
 }
Example #3
0
/**
 * Output list of upcoming events for the location.
 * @since 2.0.0
 * @version 2.0.0
 * @param integer $limit [optional] Event List Size (Default:5)
 * @return void
 */
function location_events($limit = 5)
{
    global $lID, $hc_cfg, $hc_lang_core, $hc_lang_locations;
    $result = doQuery("SELECT PkID, Title, StartDate, StartTime, EndTime, TBD\r\n\t\t\t\t\t\tFROM " . HC_TblPrefix . "events \r\n\t\t\t\t\t\t\tWHERE IsActive = 1 AND IsApproved = 1 AND LocID = '" . cIn($lID) . "' AND StartDate >= '" . cIn(SYSDATE) . "'\r\n\t\t\t\t\t\tORDER BY StartDate, TBD, StartTime, Title\r\n\t\t\t\t\t\tLIMIT " . cIn($limit));
    if (!hasRows($result)) {
        echo '<p>' . $hc_lang_locations['NoEvents'] . ' <a href="' . CalRoot . '/index.php?com=submit" rel="nofollow">' . $hc_lang_locations['NoEventsLink'] . '</a></p>';
        return 0;
    }
    $cnt = $date = 0;
    while ($row = mysql_fetch_row($result)) {
        if ($date != $row[2]) {
            $date = $row[2];
            echo $cnt > 0 ? '
			</ul>' : '';
            echo '
			<header>' . stampToDate($row[2], $hc_cfg[14]) . '</header>
			<ul>';
            $cnt = 1;
        }
        $hl = $cnt % 2 == 0 ? ' class="hl"' : '';
        if ($row[5] == 0) {
            $time = $row[3] != '' ? stampToDate($row[3], $hc_cfg[23]) : '';
            $time .= $row[4] != '' ? ' - ' . stampToDate($row[4], $hc_cfg[23]) : '';
            $stamp = date("Y-m-d\\Th:i:00", strtotime($row[2] . trim(' ' . $row[3]))) . HCTZ;
        } else {
            $time = $row[5] == 1 ? $hc_lang_locations['AllDay'] : $hc_lang_locations['TBA'];
            $stamp = date("Y-m-d", strtotime($row[2]));
        }
        echo '
			<li' . $hl . ' itemscope itemtype="http://schema.org/Event"><time itemprop="startDate" datetime="' . $stamp . '">' . $time . '</time><a itemprop="url" href="' . CalRoot . '/index.php?eID=' . $row[0] . '"><span itemprop="name">' . cOut($row[1]) . '</span></a></li>';
        ++$cnt;
    }
    echo '</ul>';
}
function cleanupRequests($location, $table)
{
    global $gSkipRuns, $gbActuallyDoit;
    $query = "select * from crawls where location = '{$location}' and finishedDateTime is not null order by crawlid desc limit " . ($gSkipRuns + 1) . ";";
    $results = doQuery($query);
    mysql_data_seek($results, $gSkipRuns);
    $row = mysql_fetch_assoc($results);
    if ($gbActuallyDoit) {
        $nUnfinished = doSimpleQuery("select count(*) from crawls where location = '{$location}' and finishedDateTime is null;");
        if (0 < $nUnfinished) {
            echo "SORRY! There is an unfinished crawl for location '{$location}'. Skipping the cleanup while the crawl is running.\n";
            return;
        }
        // Actually delete rows and optimize the table.
        echo "Delete requests from \"{$table}\" table starting with crawl \"{$row['label']}\" crawlid={$row['crawlid']} minPageid={$row['minPageid']} maxPageid={$row['maxPageid']}...\n";
        $cmd = "delete from {$table} where crawlid <= {$row['crawlid']};";
        echo "{$cmd}\n";
        doSimpleCommand($cmd);
        echo "DONE\nOptimize table \"{$table}\"...\n";
        doSimpleCommand("optimize table {$table};");
        echo "DONE\n";
    } else {
        echo "WOULD delete requests from \"{$table}\" table starting with crawl \"{$row['label']}\" crawlid={$row['crawlid']} minPageid={$row['minPageid']} maxPageid={$row['maxPageid']}...\n";
    }
}
	public function testCreateReservationFromWeekdaytoWeekend(){
	
		$this->setSessionUserAdmin();
		$startDate = '2011-11-18'; # A Friday
		$length = 1;
		$endDate = '2011-11-21'; # The Next Monday
		$actualLength = 3;
		$equipId = 1;
		$userComment = "test user comment";
		$adminComment = "test admin comment";
		$modStatus = RES_STATUS_PENDING;
		
		createReservation(getSessionVariable('user_id'), $equipId, $startDate, $length, $userComment, $adminComment, $modStatus);
		
		$actualReservation = mysql_fetch_assoc(doQuery("select * from ".getConfigVar('db_prefix')."_reservations ORDER BY res_id DESC LIMIT 1"));
		
		$this->assertEquals(getSessionVariable('user_id'), $actualReservation['user_id'], "User IDs not equal");
		$this->assertEquals($equipId, $actualReservation['equip_id'], "Equip IDs not equal");
		$this->assertEquals($startDate, $actualReservation['start_date'], "Start dates not equal");
		$this->assertEquals($actualLength, $actualReservation['length'], "Lengths not equal");
		$this->assertEquals($endDate, $actualReservation['end_date'], "End dates not equal");
		$this->assertEquals($userComment, $actualReservation['user_comment'], "User comments not equal");
		$this->assertEquals($adminComment, $actualReservation['admin_comment'], "Admin comments not equal");
		$this->assertEquals($modStatus, $actualReservation['mod_status'], "Statuses not equal");
	
	}
Example #6
0
 public function areFriends($uId1, $uId2)
 {
     $db_prefix = getDbPrefix();
     $sql = "SELECT * FROM {$db_prefix}friend WHERE `uid` = '{$uId1}' AND `friend_uid` = '{$uId2}' AND `status` = '1' LIMIT 1";
     $result = doQuery($sql) ? true : false;
     return new APIResponse($result);
 }
Example #7
0
function gridStatus()
{
    $gridStatus;
    $result = doQuery("SELECT UNIX_TIMESTAMP(state.time) AS timestamp, value, id FROM state WHERE state.key = 'gridStatus'");
    if ($result->numRows() == 1) {
        $state = $result->fetchRow(DB_FETCHMODE_ASSOC);
        if (time() - $state['timestamp'] > 300) {
            $gridStatus = getGridStatus();
            #			print "Update " . $gridStatus;
            if ($gridStatus != $state['value'] && $gridStatus != null) {
                doQuery("UPDATE state SET time=null, value = '" . $gridStatus . "' WHERE id = " . $state['id']);
            }
        } else {
            #			print "Cached " . $state['value'];
            $gridStatus = $state['value'];
        }
    } else {
        $gridStatus = getGridStatus();
        if ($gridStatus != null) {
            #		print "New " . $gridStatus;
            doQuery("DELETE FROM state WHERE state.key = 'gridStatus'");
            doQuery("INSERT INTO state VALUES(null, null, null, 'gridStatus', '{$gridStatus}')");
        }
    }
    return $gridStatus;
}
function addToLog($userid, $action, $description)
{
    $userid = makeStringSafe($userid);
    $action = makeStringSafe($action);
    $description = makeStringSafe($description);
    $mysqldate = getCurrentMySQLDateTime();
    $ip = getClientIP();
    $hostname = getClientHostname();
    doQuery("INSERT INTO " . getDBPrefix() . "_log SET user_id = '" . $userid . "', action_type = '" . $action . "', action_description = '" . $description . "', date = '" . $mysqldate . "', ip = '" . $ip . "', hostname='" . $hostname . "'");
}
 function remove($appIds)
 {
     $db_prefix = getDbPrefix();
     $appIds = "'" . implode("','", $appIds) . "'";
     $result = doQuery("DELETE FROM {$db_prefix}myop_userapp WHERE `appid` IN ( {$appIds} )");
     $result = doQuery("DELETE FROM {$db_prefix}myop_userappfield WHERE `appid` IN ( {$appIds} )") || $result;
     $result = doQuery("DELETE FROM {$db_prefix}myop_myapp WHERE `appid` IN ( {$appIds} )") || $result;
     //TODO: update cache
     return new APIResponse($result);
 }
Example #10
0
 function getFriendInfo($uId, $num = MY_FRIEND_NUM_LIMIT, $isExtra = false)
 {
     $users = $this->getUsers(array($uId), false, true, $isExtra, true, $num, false, true);
     $db_prefix = getDbPrefix();
     $totalNum = doQuery("SELECT COUNT(*) AS count FROM {$db_prefix}weibo_follow WHERE `uid` = {$uId}");
     $totalNum = $totalNum[0]['count'];
     $friends = $users[0]['friends'];
     unset($users[0]['friends']);
     $result = array('totalNum' => $totalNum, 'friends' => $friends, 'me' => $users[0]);
     return new APIResponse($result);
 }
Example #11
0
/**
 * Output weekly dashboard to a page outside of Helios Calendar.
 * @since 2.0.1
 * @version 2.0.1
 * @param binary $submit include submit event link, 0 = hide , 1 = show (Default:1)
 * @param binary $ical include iCalendar subscription link, 0 = hide, 1 = show (Default:1)
 * @param binary $rss include All Events rss feed link, 0 = hide, 1 = show (Default:1)
 * @param binary $end_time include end time in event lists, 0 = hide, 1 = show (Default:1)
 * @param string $menu_format menu format string, accepts any supported strftime() format parameters (Default:%a %m/%d)
 * @return void
 */
function ou_event_carousel($submit = 1, $ical = 1, $rss = 1, $end_time = 1, $menu_format = '%a %m/%d')
{
    global $hc_cfg, $hc_lang_core;
    include HCLANG . '/public/integration.php';
    echo "SYSDATE: " . SYSDATE . "\n";
    if (file_exists(HCPATH . '/cache/int14_' . SYSDATE . '.php')) {
        if (count(glob(HCPATH . '/cache/int14_*.php')) > 0) {
            foreach (glob(HCPATH . '/cache/int14_*.php') as $file) {
                unlink($file);
            }
        }
        ob_start();
        $fp = fopen(HCPATH . '/cache/int14_' . SYSDATE . '.php', 'w');
        fwrite($fp, "<?php\n//\tHelios Dashboard Integration Events Cache - Delete this file when upgrading.\n");
        //link, category, title, start date, end date, start time, end time, location, description
        //array("05/15/2015 - 05/15/2015","1","test event")
        $result = doQuery("SELECT PkID, Title, Description, StartDate, EndDate, StartTime,  EndTime, TBD, LocID, LocationName  FROM " . HC_TblPrefix . "events\nWHERE IsActive = 1 AND IsApproved = 1 AND StartDate Between '" . SYSDATE . "' AND ADDDATE('" . SYSDATE . "', INTERVAL 14 DAY)\nORDER BY StartDate, TBD, StartTime, Title, LocationName");
        if (hasRows($result)) {
            $cur_day = -1;
            $cur_date = '';
            fwrite($fp, "\$hc_next14 = array(\n");
            while ($row = mysql_fetch_row($result)) {
                print_r($row);
                $ouTitle = $row[1];
                $ouDesc = $row[2];
                $ouLoc = $row[7];
                //echo "\nouLoc: " . $ouLoc;
                if ($cur_date = $row[3]) {
                    ++$cur_day;
                    $cur_date = $row[3];
                    if ($cur_day > 0) {
                        fwrite($fp, "\t),\n");
                    }
                    fwrite($fp, $cur_day . " => array(\n");
                }
                if ($row[6] == 0) {
                    $time = $row[4] != '' ? stampToDate($row[4], $hc_cfg[24]) : '';
                    $time .= $row[5] != '' && $end_time == 1 ? ' - ' . stampToDate($row[5], $hc_cfg[24]) : '';
                } else {
                    $time = $row[6] == 1 ? $hc_lang_int['AllDay'] : $hc_lang_int['TimeTBA'];
                }
                fwrite($fp, "\t" . $row[0] . " => array(\"" . $time . "\",\"" . stampToDate($row[3], $hc_cfg[15]) . "\",\"" . str_replace("\"", "'", cOut($row[1])) . "\"),\n");
            }
            fwrite($fp, "\t),");
        }
        fwrite($fp, "\n)\n?>");
        fwrite($fp, ob_get_contents());
        fclose($fp);
        ob_end_clean();
    }
    include HCPATH . '/cache/int14_' . SYSDATE . '.php';
}
Example #12
0
function createRecentlyUsed()
{
    $maxEntries = 25;
    $query = "SELECT pwd, status, date_format(last_used,\"%Y-%m-%d\"), dl_count FROM dl_pwds ORDER BY last_used DESC";
    $result = doQuery($query);
    $res = "<table>\n";
    $res = $res . "<tr><td colspan=3><b>Recently used passwords:</b></td></tr>\n";
    $entryCount = 0;
    while (($row = mysql_fetch_row($result)) && $entryCount < $maxEntries) {
        if (0 == $entryCount) {
            $txt = "<tr>\n";
            $txt = "<tr>";
            $txt = $txt . "<td>Password</td>";
            $txt = $txt . "<td width=\"20\">&nbsp;</td>";
            $txt = $txt . "<td>D/L count</td>";
            $txt = $txt . "<td width=\"20\">&nbsp;</td>";
            $txt = $txt . "<td>Staus</td>\n";
            $txt = $txt . "<td width=\"20\">&nbsp;</td>";
            $txt = $txt . "<td>Last used</td></tr>\n";
            $res = $res . $txt;
        }
        $pwd = $row[0];
        $status = $row[1];
        if ($status == 'n') {
            $status = "normal";
        }
        if ($status == 'r') {
            $status = "rogue";
        }
        if ($status == 'd') {
            $status = "disabled";
        }
        $dateLastUsed = $row[2];
        $dlCount = $row[3];
        if ($status == "rogue") {
            $txt = '<tr style="color:red";>';
        } else {
            $txt = "<tr>";
        }
        $txt .= "\n  <td>{$pwd}</td>";
        $txt .= "\n  <td width=\"20\">&nbsp;</td>";
        $txt .= "\n  <td align=\"center\">{$dlCount}</td>";
        $txt .= "\n  <td width=\"20\">&nbsp;</td>";
        $txt .= "\n  <td>{$status}</td>";
        $txt .= "\n  <td width=\"20\">&nbsp;</td>";
        $txt .= "\n  <td>{$dateLastUsed}</td>\n</tr>\n";
        $res = $res . $txt;
        $entryCount += 1;
    }
    $res = $res . "</table>\n";
    return $res;
}
function doQueryQueue($i_queries)
{
    global $g_db, $lngstr;
    $g_db->debug = true;
    if ($i_queries) {
        foreach ($i_queries as $i_table => $i_tablequeries) {
            foreach ($i_tablequeries as $i_queryid => $i_query) {
                doQuery($i_queryid > 0 ? '' : sprintf($lngstr['install_db']['create_or_modify_tablex'], $i_table), $i_query);
            }
        }
    }
    $g_db->debug = false;
}
Example #14
0
function checkPassword($pwd)
{
    $query = "\r\n\tSELECT dl_count\r\n\t  FROM dl_pwds\r\n\t WHERE pwd='{$pwd}'\r\n           AND status='n'";
    $result = doQuery($query);
    if (!($row = mysql_fetch_row($result))) {
        return PWD_CHECK_NOT_FOUND;
    }
    $count = $row[0];
    //check if the file hasn't been used more than 3 times
    if ($count > ALLOWED_DLS_COUNT - 1) {
        return PWD_CHECK_USED_TOO_MANY_TIMES;
    }
    return PWD_CHECK_VALID;
}
function isEquipmentReserved($equipid, $date)
{
    $equipid = makeStringSafe($equipid);
    $date = makeStringSafe($date);
    $start_Date = new DateTime($date);
    $start_Date->modify("+3 day");
    //$interval = new DateInterval("P3D");
    //$start_Date->add($interval);
    $result = doQuery("SELECT * FROM " . getDBPrefix() . "_reservations WHERE equip_id = '" . $equipid . "' AND (mod_status = '" . RES_STATUS_CONFIRMED . "' or mod_status = '" . RES_STATUS_PENDING . "') AND (start_date BETWEEN '" . $date . "' and '" . $start_Date->format("Y-m-d") . "')");
    if (mysql_num_rows($result) > 0) {
        return true;
    } else {
        return false;
    }
}
Example #16
0
function checkLoginFromAdmin($userid_from_zend)
{
    $front = Frontend::getInstance();
    if (isset($userid_from_zend) && $userid_from_zend != "" && $userid_from_zend != -2) {
        //echo "0*".$userid_from_zend."*";
        $user_id = (int) $userid_from_zend;
        if ($user_id == 0) {
            die("Admin session expired");
        }
        if ($front->isUserLoggedIn() && isset($_SESSION["userid"]) && $_SESSION["userid"] != 0 && $_SESSION["userid"] == $user_id) {
            // already logged nothing to do
        } else {
            if ($front->isUserLoggedIn() && isset($_SESSION["userid"]) && $_SESSION["userid"] != 0 && $_SESSION["userid"] != $user_id) {
                die("You are logged in Love application with another userid in this session. Please, logout from Love application!" . $_SESSION["userid"] . "**" . $user_id);
            } else {
                $sql = "SELECT " . USERS . ".*, " . COMPANY . ".name as company_name  " . "FROM " . USERS . ", " . COMPANY . " " . "WHERE " . USERS . ".id = " . mysql_real_escape_string($user_id) . " AND " . USERS . ".company_id = " . COMPANY . ".id";
                $row = doQuery($sql);
                $username = $row->username;
                $nickname = $row->nickname;
                //           $admin = $row->admin;
                $_SESSION["userid"] = $user_id;
                $_SESSION["username"] = $username;
                $_SESSION["nickname"] = $nickname;
                //         $_SESSION["admin"] = $admin;
                $_SESSION['running'] = "true";
                if (!$front->isUserLoggedIn()) {
                    $front = new Frontend();
                    if (!$front->isUserLoggedIn()) {
                        clearSession();
                        die("You are still not logged! Click on another tab, and come back back here it could work");
                    }
                }
                if (!isAdmin($user_id)) {
                    clearSession();
                    die("You should have admin right to get access to this page." . $admin . "**" . USERS);
                }
            }
        }
    }
    if (!$front->isUserLoggedIn()) {
        clearSession();
        $front->getUser()->askUserToAuthenticate();
    }
    if (!isAdmin($_SESSION["userid"])) {
        clearSession();
        die("You should have admin right to get access to this page.");
    }
}
Example #17
0
 public function getUpdatedFriends($num)
 {
     $db_prefix = getDbPrefix();
     $totalNum = doQuery("SELECT COUNT(*) AS count FROM {$db_prefix}myop_friendlog");
     $totalNum = $totalNum[0]['count'];
     $friends = array();
     if ($totalNum) {
         $res = doQuery("SELECT * FROM {$db_prefix}myop_friendlog ORDER BY dateline DESC LIMIT {$num}");
         foreach ($res as $friend) {
             $friends[] = array('uId' => $friend['uid'], 'uId2' => $friend['fuid'], 'action' => $friend['action']);
             //删除记录
             doQuery("DELETE FROM {$db_prefix}myop_friendlog WHERE `uid` = {$friend['uid']} AND `fuid` = {$friend['fuid']}");
         }
     }
     $result = array('totalNum' => $totalNum, 'friends' => $friends);
     return new APIResponse($result);
 }
Example #18
0
function getPowerArrayForLens($lensID)
{
    $sql = "\n\tSELECT *\n\tFROM pn_lenses_powers\n\tWHERE lensID = {$lensID} \n\t";
    $results = doQuery($sql);
    //print_r($results);
    //$returnArray = array();
    if ($results['head']['status'] == 1) {
        $powerLists = makeLists($results['body']);
        //print_r($powerLists);
        if ($powerLists) {
            $returnArray = array('head' => array('status' => '1', 'error_number' => '', 'error_message' => ''), 'body' => $powerLists[$lensID]);
        }
    }
    if (!isset($returnArray)) {
        $returnArray = array('head' => array('status' => '0', 'error_number' => '404', 'error_message' => 'Data not found'), 'body' => array());
    }
    // print_r($returnArray);
    return $returnArray;
}
Example #19
0
 function publishTemplatizedAction($uId, $appId, $titleTemplate, $titleData, $bodyTemplate, $bodyData, $bodyGeneral = '', $image1 = '', $image1Link = '', $image2 = '', $image2Link = '', $image3 = '', $image3Link = '', $image4 = '', $image4Link = '', $targetIds = '', $privacy = '', $hashTemplate = '', $hashData = '', $specialAppid = 0)
 {
     global $_SITE_CONFIG;
     $db_prefix = getDbPrefix();
     $site_userapp_url = SITE_URL . '/apps/myop/userapp.php';
     $site_cp_url = SITE_URL . '/apps/myop/cp.php';
     if (strpos($titleTemplate, MYOP_URL) === false) {
         $titleTemplate = str_replace('userapp.php', $site_userapp_url, $titleTemplate);
         $titleTemplate = str_replace('cp.php', $site_cp_url, $titleTemplate);
     }
     foreach ($titleData as $k => $v) {
         if (strpos($titleTemplate, MYOP_URL) === false) {
             $v = str_replace('userapp.php', $site_userapp_url, $v);
             $v = str_replace('cp.php', $site_cp_url, $v);
         }
         $titleTemplate = str_replace('{' . $k . '}', $v, $titleTemplate);
     }
     if (strpos($bodyTemplate, MYOP_URL) === false) {
         $bodyTemplate = str_replace('userapp.php', $site_userapp_url, $bodyTemplate);
         $bodyTemplate = str_replace('cp.php', $site_cp_url, $bodyTemplate);
     }
     foreach ($bodyData as $k => $v) {
         if (strpos($bodyTemplate, MYOP_URL) === false) {
             $v = str_replace('userapp.php', $site_userapp_url, $v);
             $v = str_replace('cp.php', $site_cp_url, $v);
         }
         $bodyTemplate = str_replace('{' . $k . '}', $v, $bodyTemplate);
     }
     $titleTemplate = str_replace('{actor}', '', $titleTemplate);
     $bodyTemplate = str_replace('{actor}', '<a href="' . U('home/Space/index', array('uid' => $uId)) . '">' . getUserName($uId) . '</a>', $bodyTemplate);
     $content = array('title' => stripslashes($titleTemplate), 'content' => stripslashes($bodyTemplate), 'image1' => $image1, 'image1Link' => $image1Link, 'image2' => $image2, 'image2Link' => $image2Link, 'image3' => $image3, 'image3Link' => $image3Link, 'image4' => $image4, 'image4Link' => $image4Link);
     doLog($content, 'ContetArray');
     $content = serialize($content);
     $ctime = time();
     $sql = "INSERT INTO {$db_prefix}feed (`uid`,`data`,`type`,`ctime`) VALUES \r\n\t\t\t\t\t   ({$_SITE_CONFIG['uid']}, '{$content}', 'myop_feed','{$ctime}')";
     $result = doQuery($sql);
     return new APIResponse($result);
 }
}
setQueryVars($firstname, $lastname);
?>

    <meta charset="UTF-8">
    <title>

     <?php 
echo 'Author Images: ' . $firstname . ' ' . $lastname;
?>

    </title>

   <!-- UI stuff -->
   <script type="text/javascript" src="jquery/jquery-2.1.1.js"></script>
   <script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>

</head>

<body>

<?php 
include 'menuauthorimages.php';
$results = doQuery($firstname, $lastname, $dbh);
echo '<h1>Author Images: ' . $firstname . ' ' . $lastname . '</h1>';
printImageThumbnails($firstname, $lastname, $results, $imgnum);
?>

</body>

</html>
Example #21
0
        echo $cnt > 1 ? '
		</div>' : '';
        echo '
		<div class="catCol">';
        $cnt = 1;
    }
    echo $val != '' ? '
			<label for="cityName_' . str_replace(" ", "_", $val) . '"><input onclick="updateLink();" name="cityName[]" id="cityName_' . str_replace(" ", "_", $val) . '" type="checkbox" value="' . str_replace(" ", "_", $val) . '" />' . cOut($val) . '</label>' : '';
    ++$cnt;
}
echo '
		</div>	
	</fieldset>
	<fieldset>
		<legend>' . $hc_lang_tools['CategoriesLabel'] . '</legend>';
$result = doQuery("SELECT c.PkID, c.CategoryName, c.ParentID, c.CategoryName as Sort, NULL as Selected\r\n\t\t\t\t\tFROM " . HC_TblPrefix . "categories c \r\n\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (c.PkID = ec.CategoryID)\r\n\t\t\t\t\tWHERE c.ParentID = 0 AND c.IsActive = 1\r\n\t\t\t\t\tGROUP BY c.PkID, c.CategoryName, c.ParentID\r\n\t\t\t\t\tUNION SELECT c.PkID, c.CategoryName, c.ParentID, c2.CategoryName as Sort, NULL as Selected\r\n\t\t\t\t\tFROM " . HC_TblPrefix . "categories c \r\n\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "categories c2 ON (c.ParentID = c2.PkID) \r\n\t\t\t\t\t\tLEFT JOIN " . HC_TblPrefix . "eventcategories ec ON (c.PkID = ec.CategoryID) \r\n\t\t\t\t\tWHERE c.ParentID > 0 AND c.IsActive = 1\r\n\t\t\t\t\tGROUP BY c.PkID , c.CategoryName, c.ParentID, c2.CategoryName\r\n\t\t\t\t\tORDER BY Sort, ParentID, CategoryName");
$cnt = 1;
echo '
		<div class="catCol">';
while ($row = mysql_fetch_row($result)) {
    if ($cnt > ceil(mysql_num_rows($result) / $columns) && $row[2] == 0) {
        echo $cnt > 1 ? '
		</div>' : '';
        echo '
		<div class="catCol">';
        $cnt = 1;
    }
    $sub = $row[2] != 0 ? ' class="sub"' : '';
    echo '
			<label for="catID_' . $row[0] . '"' . $sub . '><input onclick="updateLink();" name="catID[]" id="catID_' . $row[0] . '" type="checkbox" value="' . $row[0] . '" />' . cOut($row[1]) . '</label>';
    ++$cnt;
Example #22
0
function checkExpiredDemoUser($userid, $groups = 0)
{
    global $mode, $skin, $noHTMLwrappers;
    if ($groups == 0) {
        $groups = getUsersGroups($userid, 1);
    }
    if (count($groups) != 1) {
        return;
    }
    $tmp = array_values($groups);
    if ($tmp[0] != 'demo') {
        return;
    }
    $query = "SELECT start " . "FROM log " . "WHERE userid = {$userid} " . "AND finalend < NOW() " . "ORDER BY start " . "LIMIT 3";
    $qh = doQuery($query, 101);
    $expire = time() - SECINDAY * 3;
    $rows = mysql_num_rows($qh);
    if ($row = mysql_fetch_assoc($qh)) {
        if ($rows >= 3 || datetimeToUnix($row['start']) < $expire) {
            if (in_array($mode, $noHTMLwrappers)) {
                # do a redirect and handle removal on next page load so user can
                #   be notified - doesn't always work, but handles a few extra
                #   cases
                header("Location: " . BASEURL . SCRIPT);
            } else {
                $nodemoid = getUserGroupID('nodemo', getAffiliationID('ITECS'));
                $query = "DELETE FROM usergroupmembers " . "WHERE userid = {$userid}";
                # because updateGroups doesn't
                # delete from custom groups
                doQuery($query, 101);
                updateGroups(array($nodemoid), $userid);
                checkUpdateServerRequestGroups($groupid);
                if (empty($skin)) {
                    $skin = 'default';
                    require_once "themes/{$skin}/page.php";
                }
                $mode = 'expiredemouser';
                printHTMLHeader();
                print "<h2>Account Expired</h2>\n";
                print "The account you are using is a demo account that has now expired. ";
                print "You cannot make any more reservations. Please contact <a href=\"";
                print "mailto:" . HELPEMAIL . "\">" . HELPEMAIL . "</a> if you need ";
                print "further access to VCL.<br>\n";
            }
            cleanSemaphore();
            # probably not needed but ensures we do not leave stale entries
            printHTMLFooter();
            dbDisconnect();
            exit;
        }
    }
}
Example #23
0
        doQuery($query);
        echo "<br> ID " . $numericAddressArray['id'] . " | Old code: " . $numericAddressArray['country'] . " | New code: " . $countryAlpha . " \n";
    }
    echo "<br>OK.\n";
    // REMOVE COUNTRY TABLE
    echo "<br>Removing table " . $db_prefix . "country from database... ";
    doQuery("DROP TABLE IF EXISTS " . $db_prefix . "country");
    echo "OK.\n";
    // CONTACT TABLE CHANGES HERE
    // alter the contact.id field to be auto_increment
    echo "<br>Implementing auto increment... ";
    doQuery("ALTER TABLE " . $db_prefix . "contact CHANGE id id INT(11) NOT NULL AUTO_INCREMENT");
    doQuery("DROP TABLE IF EXISTS " . $db_prefix . "counter");
    //with auto_increment, we no longer need the counter table.
    echo "OK.\n";
    doQuery("ALTER TABLE " . $db_prefix . "groups CHANGE groupid groupid INT(11) NOT NULL DEFAULT '0'");
    //changed from tinyint(4) to allow more than 127 groups
    echo "<p>Finished! Upgrade appears to be successful.\n";
    // ** END 1.03 to 1.04 UPGRADE
    ?>
<CENTER>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=570>
  <TR>
    <TD CLASS="headTitle">
       Address Book Upgrade Complete!
    </TD>
  </TR>
  <TR>
    <TD CLASS="infoBox">

        <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=560>
You may obtain a copy of the License at

     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 "../utils.inc";
require_once "batch_lib.inc";
require_once "bootstrap.inc";
// Find all the current UNCOMPLETED crawls.
$query = "select * from {$gCrawlsTable} where finishedDateTime is null;";
$result = doQuery($query);
if (isEmptyQuery($result)) {
    exit;
}
// Check each current crawl.
$gPerDone = 20;
// percentage of URLs completed to consider the crawl far enough to evaluate for errors
$gPerFailed = 15;
// acceptable failure rate
$gFirstDays = 10;
// max days to finish the first pass
$gTotalDays = 13;
// max days to finish the crawl
while ($crawl = mysql_fetch_assoc($result)) {
    // Find the DB table suffix that corresponds to this crawl.
    $location = $crawl['location'];
Example #25
0
function checkForMgmtnodeIPaddress($addr)
{
    $query = "SELECT id FROM managementnode WHERE IPaddress = '{$addr}'";
    $qh = doQuery($query, 101);
    return mysql_num_rows($qh);
}
Example #26
0
        case 3:
            $query .= ", c.CategoryName";
            break;
    }
    switch ($sortBy) {
        case 0:
            $query .= " ORDER BY c.CategoryName, e.StartDate, e.Title";
            break;
        case 1:
            $query .= " ORDER BY e.StartDate, c.CategoryName, e.Title";
            break;
        case 2:
            $query .= " ORDER BY e.StartDate, e.Title";
            break;
    }
    $resultE = doQuery($query);
    if (hasRows($resultE)) {
        $export = buildIt($header, NULL);
        while ($row = mysql_fetch_row($resultE)) {
            $export .= buildIt($content, $row);
        }
        $export .= buildIt($footer, NULL);
        $clean = str_replace($cleanUp, "", $export);
        $clean = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", $clean);
        $clean = str_replace("|N", "\n", $clean);
        echo $clean;
    } else {
        exit($hc_lang_tools['NoExport']);
    }
} else {
    exit($hc_lang_tools['NoExport']);
Example #27
0
function updateLDAPUser($authtype, $userid)
{
    global $authMechs;
    $esc_userid = mysql_real_escape_string($userid);
    $userData = getLDAPUserData($authtype, $userid);
    if (is_null($userData)) {
        return NULL;
    }
    $affilid = $authMechs[$authtype]['affiliationid'];
    $now = unixToDatetime(time());
    // select desired data from db
    $qbase = "SELECT i.name AS IMtype, " . "u.IMid AS IMid, " . "u.affiliationid, " . "af.name AS affiliation, " . "af.shibonly, " . "u.emailnotices, " . "u.preferredname AS preferredname, " . "u.uid AS uid, " . "u.id AS id, " . "u.width AS width, " . "u.height AS height, " . "u.bpp AS bpp, " . "u.audiomode AS audiomode, " . "u.mapdrives AS mapdrives, " . "u.mapprinters AS mapprinters, " . "u.mapserial AS mapserial, " . "COALESCE(u.rdpport, 3389) AS rdpport, " . "u.showallgroups " . "FROM user u, " . "IMtype i, " . "affiliation af " . "WHERE u.IMtypeid = i.id AND " . "af.id = {$affilid} AND ";
    if (array_key_exists('numericid', $userData) && is_numeric($userData['numericid'])) {
        $query = $qbase . "u.uid = {$userData['numericid']}";
    } else {
        $query = $qbase . "u.unityid = '{$esc_userid}' AND " . "u.affiliationid = {$affilid}";
    }
    $qh = doQuery($query, 255);
    $updateuid = 0;
    # check to see if there is a matching entry where uid is NULL but unityid and affiliationid match
    if (array_key_exists('numericid', $userData) && is_numeric($userData['numericid']) && !mysql_num_rows($qh)) {
        $updateuid = 1;
        $query = $qbase . "u.unityid = '{$esc_userid}' AND " . "u.affiliationid = {$affilid}";
        $qh = doQuery($query, 255);
    }
    // if get a row
    //    update db
    //    update results from select
    if ($user = mysql_fetch_assoc($qh)) {
        $user["unityid"] = $userid;
        $user["firstname"] = $userData['first'];
        $user["lastname"] = $userData["last"];
        $user["email"] = $userData["email"];
        $user["lastupdated"] = $now;
        $query = "UPDATE user " . "SET unityid = '{$esc_userid}', " . "firstname = '{$userData['first']}', " . "lastname = '{$userData['last']}', " . "email = '{$userData['email']}', ";
        if ($updateuid) {
            $query .= "uid = {$userData['numericid']}, ";
        }
        $query .= "lastupdated = '{$now}' ";
        if (array_key_exists('numericid', $userData) && is_numeric($userData['numericid']) && !$updateuid) {
            $query .= "WHERE uid = {$userData['numericid']}";
        } else {
            $query .= "WHERE unityid = '{$esc_userid}' AND " . "affiliationid = {$affilid}";
        }
        doQuery($query, 256, 'vcl', 1);
    } else {
        //    call addLDAPUser
        $id = addLDAPUser($authtype, $userid);
        $query = "SELECT u.unityid AS unityid, " . "u.affiliationid, " . "af.name AS affiliation, " . "u.firstname AS firstname, " . "u.lastname AS lastname, " . "u.preferredname AS preferredname, " . "u.email AS email, " . "i.name AS IMtype, " . "u.IMid AS IMid, " . "u.uid AS uid, " . "u.id AS id, " . "u.width AS width, " . "u.height AS height, " . "u.bpp AS bpp, " . "u.audiomode AS audiomode, " . "u.mapdrives AS mapdrives, " . "u.mapprinters AS mapprinters, " . "u.mapserial AS mapserial, " . "COALESCE(u.rdpport, 3389) AS rdpport, " . "u.showallgroups, " . "u.usepublickeys, " . "u.sshpublickeys, " . "u.lastupdated AS lastupdated " . "FROM user u, " . "IMtype i, " . "affiliation af " . "WHERE u.IMtypeid = i.id AND " . "u.affiliationid = af.id AND " . "u.id = {$id}";
        $qh = doQuery($query, 101);
        if (!($user = mysql_fetch_assoc($qh))) {
            return NULL;
        }
        $user['sshpublickeys'] = htmlspecialchars($user['sshpublickeys']);
    }
    // TODO handle generic updating of groups
    switch (getAffiliationName($affilid)) {
        case 'EXAMPLE1':
            updateEXAMPLE1Groups($user);
            break;
        default:
            //TODO possibly add to a default group
    }
    $user["groups"] = getUsersGroups($user["id"], 1);
    $user["groupperms"] = getUsersGroupPerms(array_keys($user['groups']));
    $user["privileges"] = getOverallUserPrivs($user["id"]);
    $user['login'] = $user['unityid'];
    return $user;
}
Example #28
0
<?php

require_once './common.php';
//检查漫游是否开启
if (!$_SITE_CONFIG['my_status']) {
    redirect(SITE_URL, 5, '抱歉:漫游已关闭。系统将在5秒后自动跳转至首页');
}
if (empty($_GET['id'])) {
    exit('请先选择应用');
}
$_GET['id'] = intval($_GET['id']);
$db_prefix = getDbPrefix();
$app = doQuery("SELECT * FROM {$db_prefix}myop_myapp WHERE `appid` = {$_GET['id']} LIMIT 1");
$app = $app[0];
setTitle($app['appname']);
//漫游
$my_appId = $_GET['id'];
$my_suffix = base64_decode(urldecode($_GET['my_suffix']));
$my_prefix = MYOP_URL . '/';
if (!$my_suffix) {
    header('Location: userapp.php?id=' . $my_appId . '&my_suffix=' . urlencode(base64_encode('/')));
    exit;
}
if (preg_match('/^\\//', $my_suffix)) {
    $url = 'http://apps.manyou.com/' . $my_appId . $my_suffix;
} else {
    if ($my_suffix) {
        $url = 'http://apps.manyou.com/' . $my_appId . '/' . $my_suffix;
    } else {
        $url = 'http://apps.manyou.com/' . $my_appId;
    }
function deleteMessage($messageid){

	$messageid = makeStringSafe($messageid);
	
	doQuery("DELETE FROM ".getDBPrefix()."_messages WHERE message_id = '".$messageid."' LIMIT 1");

}
Example #30
0
            if (!$fp) {
                $apiFail = true;
                $errorMsg = 'Connection to bitly Failed.';
            } else {
                $data = '';
                $request = "GET " . $bSend . " HTTP/1.1\r\nHost: " . $host . "\r\nConnection: Close\r\n\r\n";
                fwrite($fp, $request);
                while (!feof($fp)) {
                    $data .= fread($fp, 1024);
                }
                fclose($fp);
                $status_code = xml_tag_value('status_code', $data);
                if ($status_code != '200') {
                    $apiFail = true;
                    $errorMsg = 'Error Msg From bitly - <i>' . xml_tag_value('status_txt', $data) . '</i>';
                } else {
                    $bitURL = xml_tag_value('url', $data);
                }
                if ($bitURL != '') {
                    if (isset($eID)) {
                        doQuery("UPDATE " . HC_TblPrefix . "events SET ShortURL = '" . cIn($bitURL) . "' WHERE PkID = '" . cIn($eID) . "'");
                    } elseif (isset($lID)) {
                        doQuery("UPDATE " . HC_TblPrefix . "locations SET ShortURL = '" . cIn($bitURL) . "' WHERE PkID = '" . cIn($lID) . "'");
                    }
                    $shortLink = $bitURL;
                }
            }
        }
    }
}
echo $errorMsg != '' ? $errorMsg : '';